Skip to content

Source health

The functions of threats_watcher.source_health, taken from their docstrings.

threats_watcher.source_health

A feed that answers with an error for weeks is almost always a dead one (moved, closed, blocked for good). Watcher keeps since when a source fails (Source.failing_since: the first error of the current series, cleared by any good answer) and, after FAILING_DAYS days in a row, asks a person what to do with it (Pending actions): approving deletes the source, rejecting keeps it (and Watcher asks again only after another FAILING_DAYS days).

failing_since_after(status_code, failing_since, now)

The new value of failing_since after an answer: kept while the errors go on, cleared by a good answer.

queue_if_dead(source, now=None)

Queue the question for a source that has failed for FAILING_DAYS days in a row. None when it is not the time.

execute_source_failing(pa)

Approved: the source is deleted, unless it answers again (then it is kept and nothing is done).