Skip to content

Commit

Permalink
bottomless return JoinHandle - so we need to measure upload time insi…
Browse files Browse the repository at this point in the history
…de the handle because function will return almost immediately
  • Loading branch information
sivukhin committed Aug 25, 2024
1 parent 5be413d commit f4a8a1b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bottomless/src/replicator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,7 @@ impl Replicator {
let snapshot_notifier = self.snapshot_notifier.clone();
let compression = self.use_compression;
let db_path = PathBuf::from(self.db_path.clone());
let db_name = self.db_name.clone();
let handle = tokio::spawn(async move {
tracing::trace!("Start snapshotting generation {}", generation);
let start = Instant::now();
Expand Down Expand Up @@ -1126,13 +1127,13 @@ impl Replicator {
let _ = snapshot_notifier.send(Ok(Some(generation)));
let elapsed = Instant::now() - start;
tracing::debug!("Snapshot upload finished (took {:?})", elapsed);
Self::record_snapshot_upload_time(&db_name, elapsed);
// cleanup gzip/zstd database snapshot if exists
for suffix in &["gz", "zstd"] {
let _ = tokio::fs::remove_file(Self::db_compressed_path(&db_path, suffix)).await;
}
});
let elapsed = Instant::now() - start_ts;
Self::record_snapshot_upload_time(&self.db_name, elapsed);
tracing::debug!("Scheduled DB snapshot {} (took {:?})", generation, elapsed);

Ok(Some(handle))
Expand Down

0 comments on commit f4a8a1b

Please sign in to comment.