Skip to content

Commit 2e30240

Browse files
committed
fix: don't hold mutex while sleeping in test injection
1 parent 63ae626 commit 2e30240

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

stackslib/src/net/api/postblock_proposal.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,11 @@ fn get_test_delay() -> Option<u64> {
192192

193193
#[cfg(any(test, feature = "testing"))]
194194
fn inject_validation_delay() {
195-
if let Some(delay) = get_test_delay() {
196-
warn!("Sleeping for {} seconds to simulate slow processing", delay);
197-
thread::sleep(Duration::from_secs(delay));
198-
}
195+
let Some(delay) = get_test_delay() else {
196+
return;
197+
};
198+
warn!("Sleeping for {} seconds to simulate slow processing", delay);
199+
thread::sleep(Duration::from_secs(delay));
199200
}
200201

201202
/// Represents a block proposed to the `v3/block_proposal` endpoint for validation

0 commit comments

Comments
 (0)