Skip to content

Commit

Permalink
Commit everything
Browse files Browse the repository at this point in the history
  • Loading branch information
maplant committed Jan 18, 2024
1 parent 01e821b commit 89db301
Showing 3 changed files with 22 additions and 6 deletions.
12 changes: 9 additions & 3 deletions file_store/src/file_sink.rs
Original file line number Diff line number Diff line change
@@ -209,7 +209,7 @@ impl FileSinkClient {
Err(Error::channel())
}
Err(SendTimeoutError::Timeout(_)) => {
tracing::error!("file_sink write failed due to send timeout");
tracing::error!("file_sink write failed for {:?} due to send timeout", self.metric);
Err(Error::SendTimeout)
}
},
@@ -222,7 +222,10 @@ impl FileSinkClient {
.send(Message::Commit(on_commit_tx))
.await
.map_err(|e| {
tracing::error!("file_sink failed to commit with {e:?}");
tracing::error!(
"file_sink failed to commit for {:?} with {e:?}",
self.metric
);
Error::channel()
})
.map(|_| on_commit_rx)
@@ -234,7 +237,10 @@ impl FileSinkClient {
.send(Message::Rollback(on_rollback_tx))
.await
.map_err(|e| {
tracing::error!("file_sink failed to rollback with {e:?}");
tracing::error!(
"file_sink failed to rollback for {:?} with {e:?}",
self.metric
);
Error::channel()
})
.map(|_| on_rollback_rx)
2 changes: 1 addition & 1 deletion mobile_verifier/src/coverage.rs
Original file line number Diff line number Diff line change
@@ -124,7 +124,7 @@ impl CoverageDaemon {
}
}

self.file_sink.commit().await?;
self.file_sink.commit().await?.await??;
transaction.commit().await?;

Ok(())
14 changes: 12 additions & 2 deletions mobile_verifier/src/heartbeats/wifi.rs
Original file line number Diff line number Diff line change
@@ -124,9 +124,19 @@ where
&mut transaction,
)
.await?;
self.heartbeat_sink.commit().await?;
self.seniority_sink.commit().await?;
// Ensure that we have committed our work:
tokio::try_join!(self.commit_heartbeat_sink(), self.commit_seniority_sink())?;
transaction.commit().await?;
Ok(())
}

async fn commit_heartbeat_sink(&self) -> anyhow::Result<()> {
self.heartbeat_sink.commit().await?.await??;
Ok(())
}

async fn commit_seniority_sink(&self) -> anyhow::Result<()> {
self.seniority_sink.commit().await?.await??;
Ok(())
}
}

0 comments on commit 89db301

Please sign in to comment.