perf: background poller for near-instant dashboard responses
All checks were successful
Build and Push Docker Image / build (push) Successful in 28s

- New poller.js polls all services on a configurable interval
- POLL_INTERVAL env var (default 5000ms / 5 seconds)
- All data stored in cache with TTL of 3x poll interval
- Dashboard endpoint now reads from cache only (no network calls)
- API responses are near-instant regardless of service count
- First poll runs immediately on server start
This commit is contained in:
2026-05-15 23:42:38 +01:00
parent 6baf643645
commit fe73589633
3 changed files with 229 additions and 225 deletions

View File

@@ -54,6 +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 app = express();
const PORT = process.env.PORT || 3001;
@@ -79,5 +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(`=================================`);
startPoller();
});