Summary
event_processing_permits returns its argument unchanged, yet carries #[must_use], a doc block implying it "preserves the operator's configured cap," and two dedicated tests. It applies no clamping, flooring, or transformation, so it reads as if it enforces an invariant it does not — a refactor/clarity opportunity.
Location
src/app.rs:89-92 (definition), called at src/app.rs:624. Tests at src/app.rs:965 and src/app.rs:973.
#[must_use]
fn event_processing_permits(max_concurrent_event_processing: usize) -> usize {
max_concurrent_event_processing
}
Root cause
Load-time validation already rejects max_concurrent_event_processing == 0 (and enforces the upper bound MAX_CONCURRENT_EVENT_PROCESSING), so by the time this helper runs the value is already valid. The function neither clamps nor derives anything — it's a pass-through that adds indirection and reads as meaningful validation.
Suggested fix
Inline Semaphore::new(config.server.max_concurrent_event_processing) at the call site and drop the wrapper plus its two tests — or, if a floor is ever intended, make the helper actually clamp so its name is true.
Why this is not a duplicate
No filed issue references this helper. #179 / #247 concern the config-time validation of max_concurrent_event_processing, not this pass-through wrapper.
Summary
event_processing_permitsreturns its argument unchanged, yet carries#[must_use], a doc block implying it "preserves the operator's configured cap," and two dedicated tests. It applies no clamping, flooring, or transformation, so it reads as if it enforces an invariant it does not — a refactor/clarity opportunity.Location
src/app.rs:89-92(definition), called atsrc/app.rs:624. Tests atsrc/app.rs:965andsrc/app.rs:973.Root cause
Load-time validation already rejects
max_concurrent_event_processing == 0(and enforces the upper boundMAX_CONCURRENT_EVENT_PROCESSING), so by the time this helper runs the value is already valid. The function neither clamps nor derives anything — it's a pass-through that adds indirection and reads as meaningful validation.Suggested fix
Inline
Semaphore::new(config.server.max_concurrent_event_processing)at the call site and drop the wrapper plus its two tests — or, if a floor is ever intended, make the helper actually clamp so its name is true.Why this is not a duplicate
No filed issue references this helper. #179 / #247 concern the config-time validation of
max_concurrent_event_processing, not this pass-through wrapper.