Skip to content

Jobs and Caches

The queue maintains history and claims in background_jobs. Each worker acquires jobs by claiming them conditionally on status/lease, registers worker_id, lease_until and heartbeat_at, orders by priority/date, deduplicates by key, and persists attempts. Scheduling and some caches remain local to the process.

stateDiagram-v2
[*] --> queued
queued --> running
queued --> cancelled
running --> completed
running --> queued: automatic retry
running --> failed: tentativas esgotadas
failed --> queued: retry manual
cancelled --> queued: retry manual

Jobs in execution depend on timeout/lease; cooperative cancellation of external processes should still be handled by the specific handler.

CacheLocalPolicy/LimitInvalidation
catalog/covers in memorybackend MapCACHE_TTLrefresh, login/logout, restore
metadata APIRedis60 days positive/3 negative by defaultTTL, refresh and maintenance
derived coversdisk + cache_entriesCACHE_MAX_GB, LRUfingerprint, version, cleanup
comic indicesreader service memoryfingerprintchange/restart
TanStack Querybrowserstale 60s, gc 15minmutations/refetch
PWA shell/catalog/covers/assetsCache Storageversions and up to 100/200/80 entriesSW version
offline booksCache Storage + IndexedDBexplicit/quota of the browseruser removal
PDF/comic pagesreader memorycurrent and neighborsnavigation/cleanup

No cache replaces PostgreSQL or source files.