Documentation
¶
Overview ¶
Package stallwatcher is the Pilot-side consumer of Haul's stall detection.
Every 60 seconds it polls Haul's /api/v1/stalls endpoint, correlates each stalled torrent with a grab_history row (via info_hash), writes a blocklist entry for the release (reason tagged with the stall type), and marks the grab as stalled. If the grab was triggered by auto-search, the watcher also triggers a re-search for the episode, capped by a circuit breaker to avoid loops when every release for an episode is dead.
It pulls rather than receiving webhooks, and tolerates Haul being briefly unreachable. It does not blocklist during its own first two minutes: after a restart, grabs from before it can look stalled only because they haven't been observed yet.
Index ¶
Constants ¶
const MaxStallRetriesPerEpisode = 3
MaxStallRetriesPerEpisode is the circuit breaker: after this many stall-reason blocklist entries for a (series, episode) in the last 24 hours, auto-re-search stops. Prevents infinite loops when every release for an episode happens to be dead.
const StaleGrabAge = 24 * time.Hour
StaleGrabAge is how long a grab can sit in `downloading` / `queued` / `pending` without an info_hash before the sweep marks it failed. The info_hash-less branch is invisible to the haul-stall path (haul keys stalls by info_hash), so the only signal we have is age. 24h is well past any normal "metadata fetch + tracker announce + first peer" startup, and it leaves a generous window for genuinely-slow first connects on remote VPN endpoints.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service polls Haul for stalled torrents and reacts by blocklisting the corresponding release.
func NewService ¶
func NewService( q db.Querier, blocklist *blocklist.Service, downloader *downloader.Service, bus *events.Bus, logger *slog.Logger, ) *Service
NewService constructs a stallwatcher Service. Call Run in a goroutine.