feat: make background polling disablable with on-demand fallback
- Set POLL_INTERVAL=0, off, false, or disabled to disable background polling - When disabled, data is fetched on-demand when a user opens the dashboard - On-demand results cached for 30s so other users benefit from fresh data - A user with a faster refresh rate keeps the cache warm for everyone - When polling is enabled, behaviour is unchanged (default 5s)
This commit is contained in:
@@ -54,7 +54,7 @@ const radarrRoutes = require('./routes/radarr');
|
||||
const embyRoutes = require('./routes/emby');
|
||||
const dashboardRoutes = require('./routes/dashboard');
|
||||
const authRoutes = require('./routes/auth');
|
||||
const { startPoller, POLL_INTERVAL } = require('./utils/poller');
|
||||
const { startPoller, POLL_INTERVAL, POLLING_ENABLED } = require('./utils/poller');
|
||||
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 3001;
|
||||
@@ -80,7 +80,7 @@ app.listen(PORT, () => {
|
||||
console.log(` sofarr - Your Downloads Dashboard`);
|
||||
console.log(` Server running on port ${PORT}`);
|
||||
console.log(` Log level: ${process.env.LOG_LEVEL || 'info'}`);
|
||||
console.log(` Poll interval: ${POLL_INTERVAL}ms`);
|
||||
console.log(` Polling: ${POLLING_ENABLED ? POLL_INTERVAL + 'ms' : 'disabled (on-demand)'}`);
|
||||
console.log(`=================================`);
|
||||
startPoller();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user