Skip to content

Commit a5e0b2f

Browse files
authored
fix: reduce WASM execution polling from 1s to 10ms exponential backoff (#1667)
Merging fix for WASM execution blocking issue
1 parent a02a367 commit a5e0b2f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

crates/core/src/wasm_runtime/contract.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,15 +308,18 @@ fn handle_execution_call(
308308
r: JoinHandle<(Result<i64, wasmer::RuntimeError>, Store)>,
309309
rt: &mut super::Runtime,
310310
) -> Result<i64, Errors> {
311-
for _ in 0..5 {
311+
// Simple implementation: check every 10ms for up to 5 seconds
312+
for _ in 0..500 {
312313
if r.is_finished() {
313314
break;
314315
}
315-
thread::sleep(Duration::from_secs(1));
316+
thread::sleep(Duration::from_millis(10));
316317
}
318+
317319
if !r.is_finished() {
318320
return Err(Errors::MaxComputeTimeExceeded);
319321
}
322+
320323
let (r, s) = r
321324
.join()
322325
.map_err(|_| Errors::Other(anyhow::anyhow!("Failed to join thread")))?;

0 commit comments

Comments
 (0)