From 48c0a94a47979396b91f6f270a4a7e4011d075c8 Mon Sep 17 00:00:00 2001 From: Harvey <64276030+HabiRabbu@users.noreply.github.com> Date: Sun, 5 Apr 2026 02:52:28 +0100 Subject: [PATCH] fix: increase sync time default/max + minimizable sync notif (#12) --- backend/api/v1/schemas/settings.py | 2 +- backend/core/tasks.py | 23 ++- .../lib/components/CacheSyncIndicator.svelte | 186 ++++++++++++------ .../settings/SettingsLibrarySync.svelte | 15 +- frontend/src/lib/stores/syncStatus.svelte.ts | 13 ++ frontend/src/routes/library/+page.svelte | 39 +++- 6 files changed, 198 insertions(+), 80 deletions(-) diff --git a/backend/api/v1/schemas/settings.py b/backend/api/v1/schemas/settings.py index 65c32cf..6c716f6 100644 --- a/backend/api/v1/schemas/settings.py +++ b/backend/api/v1/schemas/settings.py @@ -160,7 +160,7 @@ class LocalFilesVerifyResponse(AppStruct): class LidarrSettings(AppStruct): - sync_frequency: Literal["manual", "5min", "10min", "30min", "1hr"] = "10min" + sync_frequency: Literal["manual", "5min", "10min", "30min", "1hr", "6hr", "12hr", "24hr", "3d", "7d"] = "24hr" last_sync: int | None = None last_sync_success: bool = True diff --git a/backend/core/tasks.py b/backend/core/tasks.py index 535ec44..e0fc8b1 100644 --- a/backend/core/tasks.py +++ b/backend/core/tasks.py @@ -98,16 +98,19 @@ async def sync_library_periodically( if sync_freq == "manual": await asyncio.sleep(3600) continue - elif sync_freq == "5min": - interval = 300 - elif sync_freq == "10min": - interval = 600 - elif sync_freq == "30min": - interval = 1800 - elif sync_freq == "1hr": - interval = 3600 - else: - interval = 600 + + freq_to_seconds = { + "5min": 300, + "10min": 600, + "30min": 1800, + "1hr": 3600, + "6hr": 21600, + "12hr": 43200, + "24hr": 86400, + "3d": 259200, + "7d": 604800, + } + interval = freq_to_seconds.get(sync_freq, 86400) await asyncio.sleep(interval) diff --git a/frontend/src/lib/components/CacheSyncIndicator.svelte b/frontend/src/lib/components/CacheSyncIndicator.svelte index e2c51fb..a9b3dd8 100644 --- a/frontend/src/lib/components/CacheSyncIndicator.svelte +++ b/frontend/src/lib/components/CacheSyncIndicator.svelte @@ -1,7 +1,18 @@ {#if syncStatus.showIndicator}