Skip to content

Commit

Permalink
fix: don't hold mutex while sleeping in test injection
Browse files Browse the repository at this point in the history
  • Loading branch information
hstove committed Dec 19, 2024
1 parent 63ae626 commit 2e30240
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions stackslib/src/net/api/postblock_proposal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,11 @@ fn get_test_delay() -> Option<u64> {

#[cfg(any(test, feature = "testing"))]
fn inject_validation_delay() {
if let Some(delay) = get_test_delay() {
warn!("Sleeping for {} seconds to simulate slow processing", delay);
thread::sleep(Duration::from_secs(delay));
}
let Some(delay) = get_test_delay() else {
return;
};
warn!("Sleeping for {} seconds to simulate slow processing", delay);
thread::sleep(Duration::from_secs(delay));
}

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

0 comments on commit 2e30240

Please sign in to comment.