Skip to content

Commit 3e51ed5

Browse files
committed
try hottier abort
1 parent a61b67b commit 3e51ed5

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

src/handlers/http/modal/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ pub trait ParseableServer {
160160
// Shutdown resource monitor
161161
let _ = resource_shutdown_tx.send(());
162162

163+
// Shutdown hottier
164+
if let Some(ht_global) = HotTierManager::global() {
165+
ht_global.abort_all().await;
166+
}
167+
163168
// Initiate graceful shutdown
164169
info!("Graceful shutdown of HTTP server triggered");
165170
srv_handle.stop(true).await;

src/hottier.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,16 @@ impl HotTierManager {
613613
Ok(path)
614614
}
615615

616+
#[tracing::instrument(name = "hottier.abort", skip(self))]
617+
pub async fn abort_all(&self) {
618+
let guard = self.tasks.write().await;
619+
for (streamkey, task) in guard.iter() {
620+
task.latest.abort();
621+
task.historic.abort();
622+
info!("aborted hot tier tasks for- {streamkey:?}");
623+
}
624+
}
625+
616626
/// Discover hot-tier-enabled streams at boot and spawn a per-stream pair
617627
/// of (Latest, Historic) loops for each. New streams added later acquire
618628
/// their own loops via `spawn_stream_tasks` from the PUT hot-tier handler.
@@ -770,12 +780,6 @@ impl HotTierManager {
770780
if let Some(t) = self.tasks.write().await.remove(&key) {
771781
t.latest.abort();
772782
t.historic.abort();
773-
774-
// run these tasks till completion or till JoinError
775-
// post this, we delete the folders so its better if these tasks complete
776-
// and then deletion happens
777-
let _ = t.latest.await;
778-
let _ = t.historic.await;
779783
info!(stream = %stream, tenant = ?tenant_id, "aborted per-stream hot tier tasks");
780784
}
781785
}

0 commit comments

Comments
 (0)