Skip to content

Commit

Permalink
fix JDC stack overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
plebhash committed Jan 18, 2024
1 parent 3f07a6a commit f4be6d1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion roles/jd-client/src/job_declarator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,14 @@ impl JobDeclarator {
})
.unwrap();
}
tokio::task::yield_now().await;

// we block on the receiver to avoid infinite recursion
let receiver = self_mutex.safe_lock(|s| s.receiver.clone()).unwrap();
while receiver.is_empty() {
tokio::time::sleep(tokio::time::Duration::from_millis(1)).await;
tokio::task::yield_now().await;
}

Self::get_last_token(self_mutex).await
}
1 => {
Expand Down

0 comments on commit f4be6d1

Please sign in to comment.