Skip to content

Commit f4a8a1b

Browse files
committed
bottomless return JoinHandle - so we need to measure upload time inside the handle because function will return almost immediately
1 parent 5be413d commit f4a8a1b

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

bottomless/src/replicator.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1087,6 +1087,7 @@ impl Replicator {
10871087
let snapshot_notifier = self.snapshot_notifier.clone();
10881088
let compression = self.use_compression;
10891089
let db_path = PathBuf::from(self.db_path.clone());
1090+
let db_name = self.db_name.clone();
10901091
let handle = tokio::spawn(async move {
10911092
tracing::trace!("Start snapshotting generation {}", generation);
10921093
let start = Instant::now();
@@ -1126,13 +1127,13 @@ impl Replicator {
11261127
let _ = snapshot_notifier.send(Ok(Some(generation)));
11271128
let elapsed = Instant::now() - start;
11281129
tracing::debug!("Snapshot upload finished (took {:?})", elapsed);
1130+
Self::record_snapshot_upload_time(&db_name, elapsed);
11291131
// cleanup gzip/zstd database snapshot if exists
11301132
for suffix in &["gz", "zstd"] {
11311133
let _ = tokio::fs::remove_file(Self::db_compressed_path(&db_path, suffix)).await;
11321134
}
11331135
});
11341136
let elapsed = Instant::now() - start_ts;
1135-
Self::record_snapshot_upload_time(&self.db_name, elapsed);
11361137
tracing::debug!("Scheduled DB snapshot {} (took {:?})", generation, elapsed);
11371138

11381139
Ok(Some(handle))

0 commit comments

Comments
 (0)