diff --git a/.env.example b/.env.example index 5f9d030..4120a26 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,10 @@ # Server Configuration PORT=3001 +LOG_LEVEL=info + +# Background polling interval in ms (default: 5000) +# Set to 0 or "off" to disable and fetch on-demand instead +# POLL_INTERVAL=5000 # Emby Configuration (single instance) EMBY_URL=http://localhost:8096 @@ -16,7 +21,4 @@ SONARR_INSTANCES=[{"name": "Primary", "url": "http://localhost:8989", "apiKey": RADARR_INSTANCES=[{"name": "Primary", "url": "http://localhost:7878", "apiKey": "your_api_key"}] # qBittorrent Instances (JSON array) -QBITTORRENT_INSTANCES=[ - {"name": "ransackedcrew", "url": "https://qbittorrent.ransackedcrew.info", "username": "gronod", "password": "K32D&JDjtHA&mC"}, - {"name": "i3omb", "url": "https://qbittorrent.i3omb.com", "username": "admin", "password": "b053288369XX!"} -] +QBITTORRENT_INSTANCES=[{"name": "main", "url": "http://localhost:8080", "username": "admin", "password": "your_password"}] diff --git a/.env.sample b/.env.sample index 364acb9..a302aff 100644 --- a/.env.sample +++ b/.env.sample @@ -14,6 +14,14 @@ PORT=3001 # - silent: No logging LOG_LEVEL=info +# Background polling interval in milliseconds (default: 5000) +# sofarr polls all services in the background and caches results so +# dashboard requests are near-instant. +# Set to 0, "off", "false", or "disabled" to disable background polling. +# When disabled, data is fetched on-demand when a user opens the dashboard +# and cached for 30 seconds so other users benefit from the same fetch. +# POLL_INTERVAL=5000 + # ============================================================================= # EMBY (Authentication - Required) # ============================================================================= @@ -74,4 +82,5 @@ RADARR_INSTANCES=[{"name":"main","url":"https://radarr.example.com","apiKey":"yo # 3. URLs should include protocol (http:// or https://) # 4. For qBittorrent, ensure Web UI is enabled in settings # 5. User downloads are matched by tags in Sonarr/Radarr - tag your media! +# 6. Background polling keeps data fresh; disable it for low-resource setups # ============================================================================= diff --git a/README.md b/README.md index e8d420e..9a709a4 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,7 @@ docker run -d \ -e SABNZBD_INSTANCES='[{"name":"main","url":"http://sabnzbd:8080","apiKey":"your-key"}]' \ -e QBITTORRENT_INSTANCES='[{"name":"main","url":"http://qbit:8080","username":"admin","password":"pass"}]' \ -e LOG_LEVEL=info \ + -e POLL_INTERVAL=5000 \ docker.i3omb.com/sofarr:latest ``` @@ -130,6 +131,7 @@ services: - SABNZBD_INSTANCES=[{"name":"main","url":"http://sabnzbd:8080","apiKey":"your-key"}] - QBITTORRENT_INSTANCES=[{"name":"main","url":"http://qbit:8080","username":"admin","password":"pass"}] - LOG_LEVEL=info + - POLL_INTERVAL=5000 ``` > **Tip:** You can also use a combination — mount a `.env` file for base config, and override specific values with `-e` flags. Environment variables always take precedence. @@ -181,6 +183,8 @@ Open `http://localhost:3001` in your browser ```bash PORT=3001 # Server port LOG_LEVEL=info # Logging: debug, info, warn, error, silent +POLL_INTERVAL=5000 # Background polling interval in ms (default: 5000) + # Set to 0 or "off" to disable (on-demand mode) ``` ### Service Instances (JSON Array Format) @@ -231,6 +235,18 @@ To see your downloads, you need to tag your media in Sonarr/Radarr: ## Features in Detail +### Background Polling + +sofarr polls all configured services in the background and caches the results. Dashboard requests read from cache, making them near-instant regardless of how many services you have. + +| Setting | Behaviour | +|---------|----------| +| `POLL_INTERVAL=5000` (default) | Background poller fetches every 5s. Dashboard reads from cache instantly. | +| `POLL_INTERVAL=10000` | Poll every 10 seconds. | +| `POLL_INTERVAL=0` / `off` / `disabled` | No background polling. Data fetched on-demand when a user opens the dashboard, then cached for 30 seconds. | + +**On-demand mode** is useful for low-resource setups. When one user's browser refreshes, the fetched data is cached and served to all other users until it expires. A user with a faster refresh rate effectively keeps the cache warm for everyone. + ### Real-Time Updates - Auto-refresh every 5 seconds (configurable: 1s, 5s, 10s, or off) - In-place DOM updates for smooth UI (no flickering)