Fix next_retry busy waiting on first retry (#4192)
The `next_retry_time` gets populated when a request receives an error timeout or any other error, after thatn next_retry would check all requests in the queue returns the smallest one, which then gets used to move the main loop by creating a Delay ``` futures_timer::Delay::new(instant.saturating_duration_since(Instant::now())).await, ``` However when we retry a task for the first time we still keep it in the queue an mark it as in flight so its next_retry_time would be the oldest and it would be small than `now`, so the Delay will always triggers, so that would make the main loop essentially busy wait untill we received a response for the retry request. Fix this by excluding the tasks that are already in-flight. --------- Signed-off-by:Alexandru Gheorghe <alexandru.gheorghe@parity.io> Co-authored-by:
Andrei Sandu <54316454+sandreim@users.noreply.github.com>
Showing
- polkadot/node/network/statement-distribution/src/v2/requests.rs 1 addition, 1 deletion...ot/node/network/statement-distribution/src/v2/requests.rs
- polkadot/node/network/statement-distribution/src/v2/tests/requests.rs 25 additions, 1 deletion...e/network/statement-distribution/src/v2/tests/requests.rs
Please register or sign in to comment