namespace MediaBrowser.Controller.ScheduledTasks;
///
/// Configuration options for scan-leader election, which gates periodic library-mutating
/// scheduled tasks to a single leader instance in a multi-pod deployment.
///
public sealed class ScanLeaderOptions
{
///
/// The configuration section these options bind from.
///
public const string ConfigurationSection = "Jellyfin:ScanLeader";
///
/// The configuration key that overrides the default enablement.
///
public const string EnabledKey = ConfigurationSection + ":Enabled";
///
/// Gets or sets a value indicating whether scan-leader election is enabled. When disabled,
/// 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.
///
public bool Enabled { get; set; }
///
/// Gets or sets the duration in seconds for which the scan-leader lease is held before it must
/// be renewed. A leader that stops renewing loses the lease after this duration.
///
public int LeaseDurationSeconds { get; set; } = 60;
///
/// Gets or sets the set of scheduled task keys whose periodic (timer-driven) execution is gated
/// to the scan leader. Tasks not listed here run on every instance, and manual or API-triggered
/// runs are never gated.
///
public string[] GatedTaskKeys { get; set; } =
{
"RefreshLibrary",
"RefreshPeople",
"RefreshChapterImages",
"AudioNormalization",
"TaskExtractMediaSegments",
"KeyframeExtraction",
"CleanupUserDataTask",
"OptimizeDatabaseTask"
};
}