252 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 9817185fa3 Add lease-aware cleanup to DeleteTranscodeFileTask (#25)
* Initial plan

* Add GetActiveSessionsAsync to ITranscodeSessionStore and update DeleteTranscodeFileTask for lease-aware cleanup

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

* Fix Redis exception propagation in GetActiveSessionsAsync for safe abort behavior

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

* fix: use KeysAsync to resolve CA1849 analyzer violation

Replace synchronous IServer.Keys() with async IServer.KeysAsync()
using await foreach to satisfy CA1849 (TreatWarningsAsErrors).

CA1849: 'IServer.Keys()' synchronously blocks.
Await 'IServer.KeysAsync()' instead.

Line 161 in RedisTranscodeSessionStore.GetActiveSessionsAsync.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ZoltyMat <177592743+ZoltyMat@users.noreply.github.com>
Co-authored-by: mat <mstrommen@gmail.com>
2026-03-31 22:56:30 -04:00
karm235 6097045d71 cleanup 2025-10-07 12:20:08 -05:00
karm235 51e20a14c2 Fix LUFS detection deadlock on albums with verbose output 2025-10-07 12:11:02 -05:00
JPVenson 5a6d9180fe Add People Dedup and multiple progress fixes (#14848) 2025-09-24 15:20:30 -06:00
JPVenson a99e67544a Reenable pooling (#14778) 2025-09-12 13:57:33 -06:00
Bond-009 c7320dc189 Add more robust error handling for AudioNormalizationTask (#14728) 2025-09-03 21:12:24 -06:00
Shane Powell 71048917dd AudioNormalizationTask db progress saving (#14550) 2025-09-03 21:11:58 -06:00
Evan 29e17b6bc0 Run background ffmpeg tasks as ProcessPriorityClass.BelowNormal
Follow TrickPlay example of running other background ffmpeg tasks as ProcessPriorityClass.BelowNormal:

- Keyframe extraction
- Media info probing during library scans
- Audio normalization
- Image extraction
2025-08-15 07:18:44 +08:00
Shane Powell ba54cda774 Add progress reporting to AudioNormalizationTask. (#14306) 2025-07-27 19:27:24 -06:00
JPVenson 0e1be6ce30 Use proper scheduler that honors the parallel task limit (#14281) 2025-06-15 15:21:11 -06:00
JPVenson 1c4c9cf733 Fix UserData cleanup task and queries (#14280) 2025-06-11 17:30:57 -06:00
Marc Brooks 7037121bd0 chore/typo
s/entires/entries
2025-06-09 19:58:25 -05:00
JPVenson d3ad2aec60 Feature/persistent watch data (#14262) 2025-06-09 17:14:27 -06:00
Tim Eisele 49c6a99e00 Cleanup external item data cleanup (#14072) 2025-05-09 08:35:29 -06:00
Tim Eisele d976f13970 Recognize file changes and remove data on change (#13839) 2025-05-04 21:21:44 -06:00
Shadowghost 5c9f70c375 Cleanup Tasks and Validators 2025-04-30 09:29:13 +02:00
Tim Eisele df5671263f Merge pull request #13847 from Shadowghost/rework-chapter-management
Rework chapter management
2025-04-26 14:01:12 +02:00
Cody Robibero d848faeb75 Merge pull request #13589 from JPVenson/feature/DatabaseRefactor
[Feature] Database code refactor
2025-03-25 21:34:26 -06:00
JPVenson 160020c551 WIP fixed namespaces 2025-03-25 15:30:22 +00:00
JPVenson cd5f18a084 Fix Cleanup task not awaiting async methods 2025-03-24 17:23:16 +00:00
JPVenson feea5af2f3 Merge remote-tracking branch 'jellyfinorigin/master' into feature/DatabaseRefactor 2025-03-01 14:16:49 +00:00
Bond-009 33e8c18136 Backport pull request #13593 from jellyfin/release-10.10.z
Wait for ffmpeg to exit on Windows before we try deleting the concat file

Original-merge: 346f36bc09eb6989d7cd6439175e46b699162cbb

Merged-by: Bond-009 <bond.009@outlook.com>

Backported-by: Bond_009 <bond.009@outlook.com>
2025-02-25 15:32:02 -05:00
JPVenson 17003f4d76 Merge remote-tracking branch 'jellyfinorigin/master' into feature/pgsql_provider 2025-02-02 02:09:14 +00:00
JPVenson aa811eb1e3 Prepared Seperation of Database components for future multi provider support 2025-01-26 20:45:28 +00:00
Josh Soref 044cf9fb85 chore: fix spelling
* a
* acceleration
* addition
* altogether
* api clients
* artist
* associated
* bandwidth
* cannot
* capabilities
* case-insensitive
* case-sensitive
* configuration
* delimiter
* dependent
* diacritics
* directors
* enable
* explicitly
* filters
* finish
* have
* hierarchy
* implicit
* include
* information
* into
* its
* keepalive
* localization
* macos
* manual
* matching
* metadata
* nonexistent
* options
* overridden
* parsed
* parser
* playback
* preferring
* processes
* processing
* provider
* ratings
* retrieval
* running
* segments
* separate
* should
* station
* subdirectories
* superseded
* supported
* system
* than
* the
* throws
* transpose
* valid
* was

link: forum or chat rooms

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2025-01-25 20:05:15 -05:00
Joshua M. Boniface 93b8eade61 Merge pull request #12798 from JPVenson/feature/EFUserData
Refactor library.db into jellyfin.db and EFCore
2025-01-25 02:08:44 -05:00
Daniyar Alpyspayev 2614fecf8d move to new System.Threading.Lock type for better performance 2024-12-12 18:10:06 +05:00
JPVenson fe1aab034e Merge branch 'jellyfin:master' into feature/EFUserData 2024-12-06 17:59:27 +01:00
Ethan Pippin 06923cbf2b Implement TaskTriggerInfoType enum (#12783) 2024-12-01 17:08:37 -07:00
JPVenson b09a41ad1f WIP porting new Repository structure 2024-10-09 10:36:08 +00:00
JPVenson 5ceedced1c Feature/media segments plugin api (#12359) 2024-09-07 14:56:51 -06:00
Shadowghost 994266a54f Fixup 2024-09-04 17:50:15 +02:00
Shadowghost 08ed0a9a5d Cleanup tasks 2024-09-04 17:38:10 +02:00
Bond-009 f68038f2cf Run DeleteTranscodeFileTask on startup (#12239) 2024-07-15 08:55:31 -04:00
Bond-009 c666f9d050 Use real temp dir instead of cache dir for temp files (#12226) 2024-07-15 08:44:14 -04:00
Shadowghost 6734450d40 Backport pull request #12025 from jellyfin/release-10.9.z
Fix empty image folder removal for legacy locations

Original-merge: 476dc01f4d5bf0fdf391935ef0759b0583bf7026

Merged-by: Bond-009 <bond.009@outlook.com>

Backported-by: Joshua M. Boniface <joshua@boniface.me>
2024-06-24 20:28:58 -04:00
Bond-009 ac114b27a9 Backport pull request #11911 from jellyfin/release-10.9.z
Log album name and id in normalization task

Original-merge: c9b6ebd94fd6e91ea8da2931c7604350343da5bf

Merged-by: Bond-009 <bond.009@outlook.com>

Backported-by: Joshua M. Boniface <joshua@boniface.me>
2024-06-24 20:28:57 -04:00
Shadowghost a13dc9b91c Backport pull request #12123 from jellyfin/release-10.9.z
Fix Cleanup Task metadata saving

Original-merge: 85078d8f10e7b93f1d396a8e82a9ce3284f4a25e

Merged-by: Bond-009 <bond.009@outlook.com>

Backported-by: Joshua M. Boniface <joshua@boniface.me>
2024-06-23 11:40:56 -04:00
Bond-009 c7f87c0d69 Backport pull request #11910 from jellyfin/release-10.9.z
Audio normalization: parse ffmpeg output line by line

Original-merge: d2be2ee480a44d3ed266d4632c3f38439b0dfaf5

Merged-by: joshuaboniface <joshua@boniface.me>

Backported-by: Joshua M. Boniface <joshua@boniface.me>
2024-06-01 18:41:15 -04:00
Bond-009 3feb3f81bf More efficient array creation (#11468) 2024-04-30 13:32:59 -06:00
Bond_009 9ffb07d67f Fix filename 2024-04-30 16:16:42 +02:00
Bond_009 8c9d0df7f2 Address comments 2024-04-30 16:14:01 +02:00
Bond_009 276ae3b8b7 Skip albums that don't have multiple tracks 2024-04-29 14:50:46 +02:00
Bond_009 88a38a61b5 Improve audio normalization
* Move calculation of LUFS to a scheduled task as it's pretty slow
* Correctly calculate album LUFS
* Don't try to convert replaygain tags to LUFS values
2024-04-28 15:18:53 +02:00
John M c791331952 Fix task CleanupCollectionAndPlaylistPathsTask removing valid paths (#11410) 2024-04-23 07:08:19 -06:00
JPVenson 81d3758785 #11289 Fixed cleanup task not checking for folders (#11311) 2024-04-17 10:45:31 -06:00
Patrick Barron 8698b90594 Remove SimpleProgress 2024-02-06 09:50:46 -05:00
Bond_009 244a739675 Fix incorrect path check in CleanupCollectionAndPlaylistPathsTask 2024-01-16 20:24:28 +01:00
Cody Robibero 892973a9e3 Merge branch 'master' into media-type 2023-11-09 22:03:55 -07:00