Goal
Replace the shared DEFAULT_TIMEOUT constant in packages/configuration with per-package
timeout constants, each named to reflect the specific operation context of its package.
Remove DEFAULT_TIMEOUT from packages/configuration entirely once all consumers have
defined their own constant.
Background
DEFAULT_TIMEOUT is a Duration constant (Duration::from_secs(5)), defined in
packages/configuration/src/lib.rs. It is not used within the configuration package
itself — it exists solely for other packages to import.
A single generic timeout shared across the entire workspace is too coarse-grained. Each
package performs a different kind of network operation:
packages/tracker-client: UDP socket connect/send/receive
packages/axum-http-tracker-server: HTTP request processing via Tower's TimeoutLayer
packages/udp-tracker-server (tests): UDP client connections in contract tests
console/tracker-client: network checking (UDP, HTTP, health checks) in a CLI tool
Each package should own its timeout default with a name that reflects its specific context.
Sharing a constant from the configuration crate creates an unnecessary coupling — packages
that have no other reason to depend on torrust-tracker-configuration are forced to do so
solely for a timeout value.
This issue is a subissue of EPIC #1669 (Overhaul: Packages).
Scope
For each of the 4 consumer packages, in order:
packages/tracker-client: evaluate usage, define local constant(s), update the one import site, drop torrust-tracker-configuration if it is the only remaining reason for the dep.
packages/axum-http-tracker-server: evaluate usage, define local constant(s), update the one import site. Verify whether torrust-tracker-configuration can be dropped; drop it if so.
packages/udp-tracker-server (test file): evaluate usage, define local constant(s) in the test module, update all 4 inline import sites. Verify whether torrust-tracker-configuration can be dropped from dev-dependencies; drop it if so.
console/tracker-client: evaluate usage, define local constant(s) at crate level, update all 6 import sites, drop torrust-tracker-configuration.
packages/configuration: once DEFAULT_TIMEOUT has zero consumers across the workspace, remove the constant and its associated use std::time::Duration; import if it becomes unused.
- Regenerate the workspace coupling report (
docs/issues/open/1669-overhaul-packages/workspace-coupling-report.md) by running cargo run -p workspace-coupling.
Per-package evaluation rule: before defining the local constant(s), review how DEFAULT_TIMEOUT is used within the package. If it is used for two or more semantically distinct operations (for example, "sending/receiving data" vs. "waiting for a socket to become readable or writable"), define a separate named constant for each distinct purpose rather than a single generic timeout.
Out of Scope
- Moving
DEFAULT_TIMEOUT to packages/clock — superseded by this approach.
- Any API or behaviour changes beyond replacing the import source.
- Changing timeout values — all local constants use the same
Duration::from_secs(5).
Implementation Plan
| ID |
Task |
Notes |
| T1 |
packages/tracker-client: evaluate DEFAULT_TIMEOUT usage; define local constant(s) |
Candidates: DEFAULT_UDP_TIMEOUT |
| T2 |
packages/tracker-client: remove use torrust_tracker_configuration::DEFAULT_TIMEOUT |
Use local constant(s); cargo build -p bittorrent-tracker-client succeeds |
| T3 |
packages/tracker-client: drop torrust-tracker-configuration from Cargo.toml |
cargo machete confirms clean |
| T4 |
packages/axum-http-tracker-server: evaluate usage; define local constant(s) |
Candidates: DEFAULT_REQUEST_TIMEOUT |
| T5 |
packages/axum-http-tracker-server: remove use torrust_tracker_configuration::DEFAULT_TIMEOUT |
Use local constant(s); drop dep if possible |
| T6 |
packages/udp-tracker-server (tests): evaluate usage; define local constant(s) |
Review 4 use sites; candidates: DEFAULT_UDP_TIMEOUT |
| T7 |
packages/udp-tracker-server (tests): remove all 4 use torrust_tracker_configuration::DEFAULT_TIMEOUT |
Drop from dev-dependencies if possible |
| T8 |
console/tracker-client: evaluate usage; define local constant(s) |
Review 6 use sites across UDP, HTTP, health-check contexts; candidates: DEFAULT_NETWORK_TIMEOUT |
| T9 |
console/tracker-client: update all 6 import sites to use the local constant(s) |
Remove all use torrust_tracker_configuration::DEFAULT_TIMEOUT imports |
| T10 |
console/tracker-client: drop torrust-tracker-configuration from Cargo.toml |
cargo machete confirms clean |
| T11 |
packages/configuration: remove DEFAULT_TIMEOUT and its Duration import if unused |
Zero consumers remaining; cargo build --workspace succeeds |
| T12 |
Run cargo build --workspace and cargo test --workspace |
Clean build; all tests pass |
| T13 |
Run linter all |
Exit code 0 |
| T14 |
Regenerate workspace coupling report |
cargo run -p workspace-coupling; updates docs/issues/open/1669-overhaul-packages/workspace-coupling-report.md |
Acceptance Criteria
Spec
docs/issues/open/1669-overhaul-packages/ (spec moved from drafts once issue is created)
Goal
Replace the shared
DEFAULT_TIMEOUTconstant inpackages/configurationwith per-packagetimeout constants, each named to reflect the specific operation context of its package.
Remove
DEFAULT_TIMEOUTfrompackages/configurationentirely once all consumers havedefined their own constant.
Background
DEFAULT_TIMEOUTis aDurationconstant (Duration::from_secs(5)), defined inpackages/configuration/src/lib.rs. It is not used within theconfigurationpackageitself — it exists solely for other packages to import.
A single generic timeout shared across the entire workspace is too coarse-grained. Each
package performs a different kind of network operation:
packages/tracker-client: UDP socket connect/send/receivepackages/axum-http-tracker-server: HTTP request processing via Tower'sTimeoutLayerpackages/udp-tracker-server(tests): UDP client connections in contract testsconsole/tracker-client: network checking (UDP, HTTP, health checks) in a CLI toolEach package should own its timeout default with a name that reflects its specific context.
Sharing a constant from the configuration crate creates an unnecessary coupling — packages
that have no other reason to depend on
torrust-tracker-configurationare forced to do sosolely for a timeout value.
This issue is a subissue of EPIC #1669 (Overhaul: Packages).
Scope
For each of the 4 consumer packages, in order:
packages/tracker-client: evaluate usage, define local constant(s), update the one import site, droptorrust-tracker-configurationif it is the only remaining reason for the dep.packages/axum-http-tracker-server: evaluate usage, define local constant(s), update the one import site. Verify whethertorrust-tracker-configurationcan be dropped; drop it if so.packages/udp-tracker-server(test file): evaluate usage, define local constant(s) in the test module, update all 4 inline import sites. Verify whethertorrust-tracker-configurationcan be dropped fromdev-dependencies; drop it if so.console/tracker-client: evaluate usage, define local constant(s) at crate level, update all 6 import sites, droptorrust-tracker-configuration.packages/configuration: onceDEFAULT_TIMEOUThas zero consumers across the workspace, remove the constant and its associateduse std::time::Duration;import if it becomes unused.docs/issues/open/1669-overhaul-packages/workspace-coupling-report.md) by runningcargo run -p workspace-coupling.Per-package evaluation rule: before defining the local constant(s), review how
DEFAULT_TIMEOUTis used within the package. If it is used for two or more semantically distinct operations (for example, "sending/receiving data" vs. "waiting for a socket to become readable or writable"), define a separate named constant for each distinct purpose rather than a single generic timeout.Out of Scope
DEFAULT_TIMEOUTtopackages/clock— superseded by this approach.Duration::from_secs(5).Implementation Plan
packages/tracker-client: evaluateDEFAULT_TIMEOUTusage; define local constant(s)DEFAULT_UDP_TIMEOUTpackages/tracker-client: removeuse torrust_tracker_configuration::DEFAULT_TIMEOUTcargo build -p bittorrent-tracker-clientsucceedspackages/tracker-client: droptorrust-tracker-configurationfromCargo.tomlcargo macheteconfirms cleanpackages/axum-http-tracker-server: evaluate usage; define local constant(s)DEFAULT_REQUEST_TIMEOUTpackages/axum-http-tracker-server: removeuse torrust_tracker_configuration::DEFAULT_TIMEOUTpackages/udp-tracker-server(tests): evaluate usage; define local constant(s)DEFAULT_UDP_TIMEOUTpackages/udp-tracker-server(tests): remove all 4use torrust_tracker_configuration::DEFAULT_TIMEOUTdev-dependenciesif possibleconsole/tracker-client: evaluate usage; define local constant(s)DEFAULT_NETWORK_TIMEOUTconsole/tracker-client: update all 6 import sites to use the local constant(s)use torrust_tracker_configuration::DEFAULT_TIMEOUTimportsconsole/tracker-client: droptorrust-tracker-configurationfromCargo.tomlcargo macheteconfirms cleanpackages/configuration: removeDEFAULT_TIMEOUTand itsDurationimport if unusedcargo build --workspacesucceedscargo build --workspaceandcargo test --workspacelinter all0cargo run -p workspace-coupling; updatesdocs/issues/open/1669-overhaul-packages/workspace-coupling-report.mdAcceptance Criteria
packages/tracker-clientdefines local timeout constant(s); no import fromtorrust_tracker_configuration;torrust-tracker-configurationremoved from itsCargo.toml.packages/axum-http-tracker-serverdefines local timeout constant(s); no import fromtorrust_tracker_configuration.packages/udp-tracker-servertest file defines local timeout constant(s); no import fromtorrust_tracker_configurationin tests.console/tracker-clientdefines local timeout constant(s); no file in that package importsDEFAULT_TIMEOUTfromtorrust_tracker_configuration;torrust-tracker-configurationremoved from itsCargo.toml.packages/configuration/src/lib.rsno longer definesDEFAULT_TIMEOUT.grep -r "torrust_tracker_configuration::DEFAULT_TIMEOUT" . --include="*.rs"returns zero matches.cargo build --workspacesucceeds with zero errors.cargo test --workspacepasses with zero failures.linter allexits with code0.Spec
docs/issues/open/1669-overhaul-packages/(spec moved from drafts once issue is created)