1314 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
Copilot d60ae43b59 Wire ITranscodeSessionStore to Redis-backed impl with NullTranscodeSessionStore fallback and DI registration (#21)
* Initial plan

* feat: add Redis-backed ITranscodeSessionStore with NullTranscodeSessionStore fallback and DI registration

Co-authored-by: ZoltyMat <177592743+ZoltyMat@users.noreply.github.com>

* refactor: add code review improvements - lease expiry comment, Redis connection error handling

Co-authored-by: ZoltyMat <177592743+ZoltyMat@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ZoltyMat <177592743+ZoltyMat@users.noreply.github.com>
2026-03-31 22:56:30 -04:00
mat c69b8ccc53 fix: add missing using for IServerConfigurationManager 2026-03-31 22:56:29 -04:00
mat 138081bd8b fix(ha): register IServerConfigurationManager in pre-startup DI for PostgreSQL
The NpgsqlDataSource singleton factory in AddJellyfinDbContext calls
sp.GetRequiredService<IServerConfigurationManager>() to read pool settings.
During ApplyStartupMigrationAsync, only a subset of services are registered
in the startup service collection — IServerConfigurationManager was missing,
causing a fatal DI resolution failure when DatabaseType=Jellyfin-PostgreSQL.

Fix: register startupConfigurationManager as IServerConfigurationManager in
the migrationStartupServiceProvider service collection.

Also remove JELLYFIN_CONFIG_DIR=/config from Dockerfile.runtime ENV block.
When configDir == dataDir, MakeSanityCheckOrThrow writes .jellyfin-config at
the datadir root, then immediately throws because it expected .jellyfin-data.
Removing the env var lets configDir default to $JELLYFIN_DATA_DIR/config.
2026-03-31 22:56:29 -04:00
Bond-009 b6a96513de Merge pull request #16253 from theguymadmax/use-backupdatabase
Checkpoint WAL before moving library.db in migration
2026-02-28 10:08:36 +01:00
Bond-009 ca57166e95 Merge pull request #16204 from MBR-0001/fix-bad-subtitle-settings
Fix broken library subtitle download settings
2026-02-28 10:08:20 +01:00
MBR#0001 33496c1693 Fix broken library subtitle download settings 2026-02-26 19:54:24 +01:00
theguymadmax 5597d8e1a7 Checkpoint wal 2026-02-18 15:11:57 -05:00
theguymadmax 0166362258 Use BackupDatabase() instead of File.Move in library.db migration 2026-02-17 22:56:45 -05:00
David Federman 290463fe7b Fix migration UNIQUE constraint on BaseItemProviders
Deduplicate ProviderIds by ProviderId during MigrateLibraryDb migration
to prevent UNIQUE constraint violations when legacy data contains
duplicate provider entries for the same item.

Fixes #16134
2026-02-12 20:37:26 -08:00
Anthony Lavado 8cd5652157 Merge pull request #15672 from jellyfin/openapi-cache-z
Cache OpenApi document generation
2025-11-30 21:22:29 -05:00
crobibero 8aff4227d9 Implement caching for OpenAPI document 2025-11-30 09:19:19 -07:00
theguymadmax 177b6464ca Don't clear baseitemids (#15446) 2025-11-09 09:22:09 -07:00
Niels van Velzen d140630208 Update branding in Swagger page (#15422) 2025-11-07 18:19:30 -07:00
Cody Robibero da254ee968 return instead of break, add check to more migrations (#15322) 2025-11-01 14:17:22 -06:00
Tim Eisele e5656af1f2 Improve symlink handling (#15209) 2025-10-26 15:10:13 -06:00
Cody Robibero 2966d27c97 Skip invalid database migration (#15212) 2025-10-26 11:34:04 -06:00
JJBlue a305204cfa Skip extracted files in migration if bad timestamp or no access (#15220)
Fixes #15024
2025-10-26 10:30:43 -06:00
Cody Robibero 81b8b0ca4a Add the transcode marker during startup instead of first transcode (#15194) 2025-10-25 09:32:15 -06:00
Tim Eisele 7a1c1cd342 Skip extracted files in migration if bad timestamp or no access (#15112) 2025-10-24 17:57:19 -06:00
gnattu a245605152 Log the message more clear when network manager is not ready (#15055) 2025-10-21 17:18:26 -06:00
Tim Eisele f4a53209f4 Skip invalid keyframe cache data (#15032) 2025-10-21 17:17:56 -06:00
Cody Robibero 7dff92bb82 Use TryAdd instead of Add (#14997) 2025-10-13 22:18:37 +02:00
JPVenson f01cddf273 Add migration attribute 2025-10-09 19:45:43 +00:00
JPVenson 0d4bd0495b Add migration to remove artist and album artists from database 2025-10-09 19:44:07 +00:00
JPVenson 8ea9bece03 Add explicit reference check to migration 2025-09-28 08:46:31 +00:00
JPVenson e282b05b8f fixes #14859 Add Check for ItemValues (#14860) 2025-09-25 08:02:20 -06:00
JPVenson 740b9924a0 Include ListOrder on Import (#14854) 2025-09-24 15:22:05 -06:00
JPVenson 5a6d9180fe Add People Dedup and multiple progress fixes (#14848) 2025-09-24 15:20:30 -06:00
Cody Robibero 27047c35a4 Add schema to 503 headers (#14840) 2025-09-23 07:00:34 -06:00
JPVenson 0949212993 Make migration handle parent cleanup (#14817)
* Make migration handle parent cleanup

* Remove speed improvement

* Update MigrateLibraryDb.cs
2025-09-19 13:17:31 -06:00
JPVenson eaf33f01e1 #14751 Only migrate providerids that match assumption (#14810) 2025-09-17 18:33:23 -06:00
evan314159 2618a5fba2 Fix sync disposal of async-created IAsyncDisposable objects (#14755) 2025-09-16 11:14:52 +02:00
Bond-009 8776a447d1 Various cleanups (#14785) 2025-09-12 13:58:23 -06:00
JPVenson 20f7ddbf8f Refactor Display preference manager (#14056) 2025-09-05 14:39:15 -06:00
evan314159 7aa1c46447 Merge pull request #14653 from evan314159/coremigration
Delay initialization of singleton services during migration CoreInitialisation stage
2025-08-22 10:06:39 +02:00
JPVenson c8d2f43660 Add logging 2025-07-30 20:14:24 +00:00
JPVenson ef733c5ace use guid instead 2025-07-30 20:10:26 +00:00
JPVenson a1eb04dc0b Add full migration for IsFolder flag 2025-07-30 19:58:56 +00:00
JPVenson 711e649e35 Also migrate IsFolder 2025-07-30 19:41:34 +00:00
JPVenson c62a07405e improve userdata migration (#14488) 2025-07-19 11:34:51 -06:00
JPVenson c51f3a3342 Use IDatabaseCreator instead of relying on History repository (#14465) 2025-07-14 18:36:36 -06:00
JPVenson 55e681b9a6 Add SerilogExpressions reference (#14438) 2025-07-11 23:38:41 -06:00
gnattu 9ac8c2a2fa Fix compiler warning for CodeMigration.cs (#14390) 2025-06-29 08:00:29 -06:00
Tim Eisele c6e568692e Fix modification checks and make sure to use UTC (#14347) 2025-06-26 17:50:37 -06:00
Archie d5a76bdff8 Changed misspell of 'temporarily' in 503 response (#14377) 2025-06-26 17:49:07 -06:00
JPVenson ba0eb87371 Add migration to migrate disconnected UserData too (#14339) 2025-06-23 08:36:49 -06:00
Niels van Velzen ab99b2bad3 Merge pull request #14341 from Shadowghost/misc
Cleanup Migration
2025-06-22 08:49:24 +02:00
Shadowghost af0bcbc652 Fixup 2025-06-19 12:33:46 +02:00
Shadowghost ccb917b8df Cleanup logging and user data import skip on missing user 2025-06-18 21:33:32 +02:00