Add scheduler, rate limiting and headless mode.

Hard-coded 60s URL and 10s host floors with jitter and per-host
backoff, shared between dibs processes through a locked state file.
The scheduler shuffles due URLs each round and runs one worker per
host; 'dibs --headless' watches and logs JSON.
This commit is contained in:
Overlord committed 2026-10-14 09:04:15 +02:00
1 parent bb010356a0
commit 2175c0e5aa
30 files changed
+1434 -126

No files matched your search

-4
View File
@@ -21,7 +21,6 @@ var builtinFS embed.FS
// ErrNoPlugin is returned when no plugin matches a URL.
var ErrNoPlugin = errors.New("no plugin matches the URL")
// Builtins returns the names of the embedded plugins.
func Builtins() []string {
files, _ := fs.Glob(builtinFS, "builtin/*.lua")
@@ -31,12 +30,10 @@ func Builtins() []string {
return names
}
// BuiltinSource returns the code of an embedded plugin.
func BuiltinSource(name string) ([]byte, error) {
return builtinFS.ReadFile("builtin/" + name + ".lua")
}
// Host holds the loaded plugins.
type Host struct {
plugins map[string]*Plugin
// order is the order ForURL tries plugins in: user plugins first, so
@@ -92,7 +89,6 @@ func NewHost(user map[string]string, limits Limits, logger *slog.Logger) (*Host,
return h, nil
}
// Plugin returns the plugin called name.
func (h *Host) Plugin(name string) (*Plugin, bool) {
p, ok := h.plugins[name]
return p, ok