Skip to content

Commit

Permalink
not fail task on rpc balance query error
Browse files Browse the repository at this point in the history
  • Loading branch information
haider-rs committed Jul 15, 2024
1 parent 81d658c commit b5b74b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
19 changes: 11 additions & 8 deletions chronicle/src/tasks/spawner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,17 @@ where
}

async fn write(self, task_id: TaskId, function: Function) -> Result<()> {
let is_balance_available = self.is_balance_available().await?;
if !is_balance_available {
// unregister member
if let Err(e) = self.substrate.submit_unregister_member().await {
tracing::error!("Failed to unregister member: {:?}", e);
};
tracing::warn!("Chronicle balance too low, exiting");
std::process::exit(1);
match self.is_balance_available().await {
Ok(false) => {
// unregister member
if let Err(e) = self.substrate.submit_unregister_member().await {
tracing::error!("Failed to unregister member: {:?}", e);
};
tracing::warn!("Chronicle balance too low, exiting");
std::process::exit(1);
},
Ok(true) => {},
Err(err) => tracing::error!("Could not fetch account balance: {:?}", err),
}

let submission = async move {
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ services:
- '--timechain-metadata=development'
- '--timechain-url=ws://validator:9944'
- '--target-keyfile=/etc/target_keyfile'
- '--target-min-balance=10000'
- '--timechain-keyfile=/etc/timechain_keyfile'
- '--tss-keyshare-cache=/etc'
environment:
Expand Down

0 comments on commit b5b74b5

Please sign in to comment.