Commit Graph

10 Commits

Author SHA1 Message Date
unkinben 0008bde28e Gate periodic library-mutating tasks behind a scan-leader lease
ABI Compatibility / ABI - HEAD (pull_request) Has been cancelled
ABI Compatibility / ABI - BASE (pull_request) Has been cancelled
OpenAPI / OpenAPI - HEAD (pull_request) Has been cancelled
OpenAPI / OpenAPI - BASE (pull_request) Has been cancelled
Tests / run-phase5-tests (pull_request) Has been cancelled
Tests / run-tests (pull_request) Has been cancelled
Project Automation / Project board (pull_request) Has been cancelled
Merge Conflict Labeler / Labeling (pull_request) Has been cancelled
ABI Compatibility / ABI - Difference (pull_request) Has been cancelled
OpenAPI / OpenAPI - Difference (pull_request) Has been cancelled
OpenAPI / OpenAPI - Publish Unstable Spec (pull_request) Has been cancelled
OpenAPI / OpenAPI - Publish Stable Spec (pull_request) Has been cancelled
In a multi-pod deployment every pod runs the scheduled-task timers, so
periodic library-mutating tasks (library refresh, people/chapter refresh,
audio normalization, media-segment and keyframe extraction, collection and
user-data cleanup, database optimization) fire concurrently against the shared
database and library, duplicating work and racing each other.

Add an IScanLeaderLease abstraction that elects a single scan leader via a
Redis TTL lease keyed on the pod identity, mirroring the existing transcode
lease machinery. RedisScanLeaderLease acquires or renews the lease with an
atomic Lua script and fails safe by treating the pod as leader whenever Redis
is unreachable, so scans never stall. NullScanLeaderLease preserves the
single-instance behavior when election is disabled or no Redis connection is
configured.

Gate only the timer-driven path in ScheduledTaskWorker: when election is
enabled and a task key is in the gated set, a non-leader re-arms its trigger
and skips enqueueing. Manual and API-triggered runs bypass this path and still
run on any pod. Wiring is additive and the new worker constructor parameters
are optional, so existing behavior is unchanged when election is off.

Signed-off-by: Ben Vincent <ben@unkin.net>
2026-08-10 23:51:18 +10:00
LukePulverenti 33a3f620e6 display pending installations on dashboard home 2013-03-20 17:17:47 -04:00
LukePulverenti 4c725e69a8 added swagger api docs 2013-03-04 22:34:02 -05:00
LukePulverenti af7aa597c3 referenced core plugins, fixed some dashboard issues, extracted library manager 2013-02-28 14:32:41 -05:00
LukePulverenti 2d06095447 plugin security fixes and other abstractions 2013-02-25 22:43:04 -05:00
LukePulverenti 8ce3e74e81 More DI 2013-02-24 16:53:54 -05:00
LukePulverenti b8d5c71842 type discovery without attributes 2013-02-23 02:57:11 -05:00
LukePulverenti 8b3e8ad478 created IWebSocketListener 2013-02-22 10:16:48 -05:00
LukePulverenti 868a7ce9c8 isolated clickonce dependancies 2013-02-21 23:23:06 -05:00
LukePulverenti 767cdc1f6f Pushing missing changes 2013-02-20 20:33:05 -05:00