Skip to content

[TD-05] 219 bare Duration::from_secs/millis literals #323

@intendednull

Description

@intendednull

Audit finding from #300 (commit 679f9fe)

Severity: medium
Category: tech debt / maintenance
File: widespread; e.g. crates/client/src/connect.rs (from_secs(1)), crates/relay/src/lib.rs (multiple), crates/relay/tests/bootstrap_endpoint.rs (from_millis(50/10/100))
Obvious fix: yes (purely mechanical extract-constant)

Description

219 Duration::from_secs(N) or Duration::from_millis(N) literals. Some are appropriately bound to named constants (relay/src/lib.rs has BOOTSTRAP_IO_TIMEOUT), but many are bare magic numbers in retry loops, sleeps, and timeouts.

Impact / Threat

Maintenance — tuning a backoff or test stability requires hunting unrelated files.

Suggested fix

Introduce a timeouts module per crate with named constants (RECONNECT_BACKOFF, HEARTBEAT_INTERVAL, etc.) and replace the literals.

Verify

rg "Duration::from_(secs|millis)\([0-9]" --type rust crates/ | wc -l

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions