fix(ha): gate library tasks on the scan leader by default
Jellyfin:ScanLeader:Enabled defaults to false and nothing sets it, so leader election never runs and every replica executes the timer-driven library tasks concurrently - the exact behaviour the lease prevents. - Enable gating by default when a Redis connection string is configured - Honour an explicit Enabled setting either way - Carry the effective decision onto the bound options the task worker reads - Log at startup whether gating is active - Warn when gating is enabled but no Redis connection string is configured
This commit is contained in:
@@ -6,9 +6,20 @@ namespace MediaBrowser.Controller.ScheduledTasks;
|
||||
/// </summary>
|
||||
public sealed class ScanLeaderOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// The configuration section these options bind from.
|
||||
/// </summary>
|
||||
public const string ConfigurationSection = "Jellyfin:ScanLeader";
|
||||
|
||||
/// <summary>
|
||||
/// The configuration key that overrides the default enablement.
|
||||
/// </summary>
|
||||
public const string EnabledKey = ConfigurationSection + ":Enabled";
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether scan-leader election is enabled. When disabled,
|
||||
/// every instance runs its periodic tasks as before.
|
||||
/// every instance runs its periodic tasks as before. Left unset, election is enabled whenever a
|
||||
/// Redis connection string is configured, because that is the only deployment shape that needs it.
|
||||
/// </summary>
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user