Skip to content

Commit

Permalink
py: Make sure to print errors when running signer in thread
Browse files Browse the repository at this point in the history
I was wondering why my signer was not reconnecting to the node, and
found out that I was on the v24.02 branch, which isn't deployed on the
servers yet. The problem was that we were calling the naked, fallible,
future in `task::spawn()` and therefore dropping an eventual
error. Maybe we should also move the upgrade out of the loop in the
first place 🤔
  • Loading branch information
cdecker committed May 29, 2024
1 parent 90108a0 commit 1dfb3e8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libs/gl-client-py/src/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ impl Signer {

let (tx, rx) = mpsc::channel(1);

std::thread::spawn(move || runtime.block_on(async move { inner.run_forever(rx).await }));
std::thread::spawn(move || {
runtime.block_on(async move {
if let Err(e) = inner.run_forever(rx).await {
log::error!("Error running signer in thread: {e}")
}
})
});
Ok(SignerHandle { signal: tx })
}

Expand Down

0 comments on commit 1dfb3e8

Please sign in to comment.