Browse Source

More resilient loop error handling

We are looping over multiple CFDs when trying to publish the CET.
If we fail inside the loop then the next CFD(s) are not processed and CETs might not get published properly.
This should make the code more resilient.
temporary-fast-timelocks
Daniel Karzel 3 years ago
parent
commit
cea476c606
No known key found for this signature in database GPG Key ID: 30C3FC2E438ADB6E
  1. 5
      daemon/src/maker_cfd.rs
  2. 5
      daemon/src/taker_cfd.rs

5
daemon/src/maker_cfd.rs

@ -837,7 +837,10 @@ impl Actor {
insert_new_cfd_state_by_order_id(cfd.order.id, cfd.state.clone(), &mut conn).await?;
self.try_cet_publication(cfd).await?;
if let Err(e) = self.try_cet_publication(cfd).await {
tracing::error!("Error when trying to publish CET: {:#}", e);
continue;
}
}
Ok(())

5
daemon/src/taker_cfd.rs

@ -617,7 +617,10 @@ impl Actor {
insert_new_cfd_state_by_order_id(cfd.order.id, cfd.state.clone(), &mut conn).await?;
self.try_cet_publication(cfd).await?;
if let Err(e) = self.try_cet_publication(cfd).await {
tracing::error!("Error when trying to publish CET: {:#}", e);
continue;
}
}
Ok(())

Loading…
Cancel
Save