Files
unkin-agent 1965c68a76
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
fix(ha): gate the remaining timer-driven scheduled tasks
Add the eight provider, live TV and plugin-update task keys to
ScanLeaderOptions.GatedTaskKeys and widen the test's task-key discovery to
every assembly that declares an IScheduledTask.
2026-09-20 23:36:34 +10:00

57 lines
2.1 KiB
C#

namespace MediaBrowser.Controller.ScheduledTasks;
/// <summary>
/// Configuration options for scan-leader election, which gates periodic library-mutating
/// scheduled tasks to a single leader instance in a multi-pod deployment.
/// </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. 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; }
/// <summary>
/// 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.
/// </summary>
public int LeaseDurationSeconds { get; set; } = 60;
/// <summary>
/// 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.
/// </summary>
public string[] GatedTaskKeys { get; set; } =
{
"RefreshLibrary",
"RefreshPeople",
"RefreshChapterImages",
"AudioNormalization",
"TaskExtractMediaSegments",
"KeyframeExtraction",
"CleanupUserDataTask",
"OptimizeDatabaseTask",
"DownloadLyrics",
"DownloadSubtitles",
"TmdbRefreshUpcomingEpisodes",
"RefreshTrickplayImages",
"MoveTrickplayImages",
"RefreshInternetChannels",
"RefreshGuide",
"PluginUpdates"
};
}