Skip to content

Conversation

tppadn
Copy link

@tppadn tppadn commented Aug 28, 2025

Adaptive Polling Implementation

Overview

Implements adaptive polling for ActivityMonitor to reduce Jellyfin CPU load. The system automatically adjusts monitoring frequency: 1s when users are watching content, 5s when idle.

Problem Solved

  • Current: ActivityMonitor polls every 1 second
  • Issue: High CPU usage on Jellyfin servers
  • Solution: Smart polling that adapts to server activity

Key Features

Adaptive intervals: 1000ms (active) / 5000ms (idle)
Web configuration: Settings panel in UI
Real-time updates: No server restart required
Backward compatible: Works with existing setups

Technical Changes

Backend

  • backend/tasks/ActivityMonitor.js - Adaptive polling logic
  • backend/routes/api.js - New config endpoints (/api/getActivityMonitorSettings, /api/setActivityMonitorSettings)

Frontend

  • src/pages/components/settings/ActivityMonitorSettings.jsx - New settings component
  • src/pages/settings.jsx - Component integration
  • Translation updates (EN/FR)

Configuration

Default: {"activeSessionsInterval": 1000, "idleInterval": 5000}

TODO

  • Translations (ES, IT, CN)

Related issues

This should help with these issues : #344 and #328

@CyferShepard
Copy link
Owner

Hey @tppadn , can you edit this to merge onto unstable first, direct merging to main branch isnt allowed as we need to do tests first

@tppadn tppadn changed the base branch from main to unstable September 29, 2025 20:59
@tppadn
Copy link
Author

tppadn commented Sep 29, 2025

Hey @CyferShepard, done! Changed base branch to unstable and resolved conflicts. It should be ok but I haven't tested it again on this branch

@CyferShepard
Copy link
Owner

Hey @tppadn , i just finished testing this out and everything looks good so far. Will be merging into unstable for greater testing

@CyferShepard CyferShepard merged commit e258682 into CyferShepard:unstable Oct 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants