-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Labels
DocumentationImproves Instructions, Guides, and NoticesImproves Instructions, Guides, and Notices
Description
This issue is being documented for the record only.
In the Grafana dashboard, the number of seeders and leechers follows a sawtooth pattern.
That's because we are running the clean job every 10 minutes (600 seconds) to remove inactive peers and peerless torrents.
Details (24h)
Details (1h)
Code
/// Cleans up torrent entries by removing inactive peers and, optionally,
/// torrents with no active peers.
///
/// This function performs two cleanup tasks:
///
/// 1. It removes peers from torrent entries that have not been updated
/// within a cutoff time. The cutoff time is calculated as the current
/// time minus the maximum allowed peer timeout, as specified in the
/// tracker policy.
/// 2. If the tracker is configured to remove peerless torrents
/// (`remove_peerless_torrents` is set), it removes entire torrent
/// entries that have no active peers.
pub fn cleanup_torrents(&self) {
let current_cutoff = CurrentClock::now_sub(&Duration::from_secs(u64::from(self.config.tracker_policy.max_peer_timeout)))
.unwrap_or_default();
self.in_memory_torrent_repository.remove_inactive_peers(current_cutoff);
if self.config.tracker_policy.remove_peerless_torrents {
self.in_memory_torrent_repository
.remove_peerless_torrents(&self.config.tracker_policy);
}
}
Config options
These are the config options that affect this job:
- core.inactive_peer_cleanup_interval (600 seconds, 10 minutes): interval to run the cleaner.
- core.tracker_policy.remove_peerless_torrents (true): whether the tracker removes peerless torrents or not.
- core.tracker_policy.max_peer_timeout (900 seconds, 15 minutes): peer is considered inactive if it hasn't announced for 15 minutes.
Metadata
Metadata
Assignees
Labels
DocumentationImproves Instructions, Guides, and NoticesImproves Instructions, Guides, and Notices