mirror of
https://github.com/tursodatabase/libsql.git
synced 2025-05-25 19:10:39 +00:00
bottomless return JoinHandle - so we need to measure upload time inside the handle because function will return almost immediately
This commit is contained in:
@ -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();
|
||||
@ -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))
|
||||
|
Reference in New Issue
Block a user