From a51479b59990ea44b6398c81d8d1d802033a9ec8 Mon Sep 17 00:00:00 2001 From: Christoph Brandau Date: Thu, 23 Jul 2026 14:25:03 +0200 Subject: [PATCH] refactor(config): Set correct default sync interval and documentation The default synchronization interval has been updated across the application to reflect a standard 30-minute delay (1800 seconds). This change updates both the source code configuration and the README documentation, ensuring that users rely on the accurate default value when no environment variable is provided. - Updated SYNC_INTERVAL_SECONDS default in src/main.py - Clarified single-run behavior in README.md --- README.md | 4 ++-- src/main.py | 2 +- tests/test_main.py | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3eda618..b92078f 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,8 @@ Optional environment variables: - `ALBUM_SEPARATOR`: Separator for `relative` mode; defaults to ` - ` - `PAGE_SIZE`: Immich search page size; defaults to `1000` - `DRY_RUN`: Set to `true` to log planned work without changing albums -- `SYNC_INTERVAL_SECONDS`: Delay between runs; `0` runs once and exits. - Docker Compose defaults to `1800` seconds (30 minutes) +- `SYNC_INTERVAL_SECONDS`: Delay between runs; defaults to `1800` seconds + (30 minutes). Set it to `0` for a single run Run the script after Immich has scanned the external library: diff --git a/src/main.py b/src/main.py index b3945b7..2e577d4 100644 --- a/src/main.py +++ b/src/main.py @@ -33,7 +33,7 @@ ALBUM_SEPARATOR = os.environ.get("ALBUM_SEPARATOR", " - ") PAGE_SIZE = int(os.environ.get("PAGE_SIZE", "1000")) DRY_RUN = os.environ.get("DRY_RUN", "false").lower() == "true" SYNC_INTERVAL_SECONDS = int( - os.environ.get("SYNC_INTERVAL_SECONDS", "0") + os.environ.get("SYNC_INTERVAL_SECONDS", "1800") ) logging.basicConfig( diff --git a/tests/test_main.py b/tests/test_main.py index 7f24871..4abd27d 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -142,6 +142,10 @@ class SynchronizationTests(unittest.TestCase): album_sync, "ALBUM_MODE", "root", + ), patch.object( + album_sync, + "SYNC_INTERVAL_SECONDS", + 0, ), patch.object( album_sync, "check_configuration",