failedgrab

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package failedgrab handles downloads that a download client reports as failed: bad NZBs, missing usenet articles, torrent errors.

For every failed grab it blocklists the release so the same release is never grabbed again, and marks the grab failed. If the grab came from automatic search, it asks for a re-search by publishing TypeAutoSearchRetry, capped by the same per-episode circuit breaker the stall watcher uses. Grabs the user picked interactively are never re-searched automatically: the user decides what to do next.

This mirrors stallwatcher.handleStall for clients other than Haul's stall endpoint. Stalls and failures share one retry budget per episode (see CountRecentStallsForEpisode in blocklist.sql).

Index

Constants

View Source
const MaxRetriesPerEpisode = 3

MaxRetriesPerEpisode is the circuit breaker: once this many stall or download-failure blocklist entries exist for a (series, episode) in the last 24 hours, automatic re-search stops. Matches stallwatcher.MaxStallRetriesPerEpisode.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blocklister

type Blocklister interface {
	AddFromDownloadFailure(ctx context.Context, p blocklist.StallEntry) error
	CountRecentStalls(ctx context.Context, seriesID, episodeID string) (int64, error)
}

Blocklister is the slice of blocklist.Service this package needs.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler reacts to failed downloads.

func New

func New(bl Blocklister, bus Publisher, logger *slog.Logger) *Handler

New creates a Handler.

func (*Handler) HandleDownloadFailed

func (h *Handler) HandleDownloadFailed(ctx context.Context, g db.GrabHistory, clientError string) error

HandleDownloadFailed blocklists the grab's release, announces the failure, and requests a re-search for automatic grabs that are still under the circuit breaker. clientError is the download client's own message, if it gave one. The caller is responsible for having already recorded the grab's status as failed.

type Publisher

type Publisher interface {
	Publish(ctx context.Context, e events.Event)
}

Publisher is the slice of events.Bus this package needs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL