Repository navigation
Closed
Labels
Description
Goal
Make torrent cleanup a directly supervised, token-aware top-level component. It must respond to JobManager::cancel() without subscribing to an OS signal, report its explicit normal terminal state, and leave no cleanup task detached.
Scope
- Replace the pre-spawned torrent-cleanup starter with an unspawned, token-aware runner.
- Move only
torrent_cleanupfromJobManager::legacy_jobsto direct namedJobManager::spawnownership. - Preserve the cleanup configuration gate, interval behavior, cleanup logic, and weak
TorrentsManagerlifetime behavior. - Add deterministic cancellation and direct-supervisor-ownership tests.
- Verify both direct-binary SIGTERM cancellation and real inactive-peer cleanup through the REST API.
- After the functional verification, add the reusable manual cleanup verification skill in a separate documentation commit.
Out of Scope
peers_inactivity_updatemigration (SI-5).- UDP IP-ban cleanup lifecycle changes.
- Cleanup policy or interval configuration changes.
- Server lifecycle APIs, drain policies, process deadline, and exit-code policy.
Key Constraints
The runner must be passed directly to JobManager::spawn; retaining a pre-spawned JoinHandle would require the wrapper pattern that #1586 prohibits. The runner returns generic Completion: token cancellation returns Cancelled; weak TorrentsManager expiry returns Completed.
Verification
- No
ctrl_c()remains intorrent_cleanup.rs. - Injected token cancellation produces
Completion::Cancelled. JobManager::cancel()reports namedtorrent_cleanup: JobStatus::Cancelled.- Direct-binary SIGTERM reports cleanup cancellation, not cleanup deadline abort.
- Local functional scenario announces a peer, confirms it through the REST API, then confirms cleanup leaves the torrent known with
"peers": []. The isolated configuration setsremove_peerless_torrents = falseso this state is observable.
Full approved specification will be added in a separate spec-only pull request.
Activity
Merge #2171: docs(issues): publish SI-4 torrent cleanup specification
docs(issues): record SI-4 review and apply review nits
docs(issues): record SI-4 review and apply review nits
docs(issues): record SI-4 review and apply review nits
docs(issues): record SI-4 review and apply review nits
Merge torrust#2181: feat(shutdown): [torrust#2169] migrate torrent cl…
chore(issues): archive closed issue specs torrust#1586, torrust#1588, t…
chore(issues): archive closed issue specs torrust#1586, torrust#1588, t…
Merge #2207: chore(issues): archive closed issue specifications