Skip to content

Commit f020c6b

Browse files
ensure init sync completion
1 parent 1d92e04 commit f020c6b

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/handlers/http/modal/ingest_server.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl ParseableServer for IngestServer {
116116
migration::run_migration(&PARSEABLE).await?;
117117

118118
// local sync on init
119-
tokio::spawn(async {
119+
let startup_sync_handle = tokio::spawn(async {
120120
if let Err(e) = sync_start().await {
121121
tracing::warn!("local sync on server start failed: {e}");
122122
}
@@ -132,7 +132,9 @@ impl ParseableServer for IngestServer {
132132
let result = self.start(shutdown_rx, prometheus.clone(), None).await;
133133
// Cancel sync jobs
134134
cancel_tx.send(()).expect("Cancellation should not fail");
135-
135+
if let Err(join_err) = startup_sync_handle.await {
136+
tracing::warn!("startup sync task panicked: {join_err}");
137+
}
136138
result
137139
}
138140
}

src/handlers/http/modal/query_server.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl ParseableServer for QueryServer {
129129
}
130130

131131
// local sync on init
132-
tokio::spawn(async {
132+
let startup_sync_handle = tokio::spawn(async {
133133
if let Err(e) = sync_start().await {
134134
tracing::warn!("local sync on server start failed: {e}");
135135
}
@@ -150,7 +150,9 @@ impl ParseableServer for QueryServer {
150150
.await?;
151151
// Cancel sync jobs
152152
cancel_tx.send(()).expect("Cancellation should not fail");
153-
153+
if let Err(join_err) = startup_sync_handle.await {
154+
tracing::warn!("startup sync task panicked: {join_err}");
155+
}
154156
Ok(result)
155157
}
156158
}

src/handlers/http/modal/server.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl ParseableServer for Server {
124124
storage::retention::load_retention_from_global();
125125

126126
// local sync on init
127-
tokio::spawn(async {
127+
let startup_sync_handle = tokio::spawn(async {
128128
if let Err(e) = sync_start().await {
129129
tracing::warn!("local sync on server start failed: {e}");
130130
}
@@ -150,7 +150,9 @@ impl ParseableServer for Server {
150150
.await;
151151
// Cancel sync jobs
152152
cancel_tx.send(()).expect("Cancellation should not fail");
153-
153+
if let Err(join_err) = startup_sync_handle.await {
154+
tracing::warn!("startup sync task panicked: {join_err}");
155+
}
154156
return result;
155157
}
156158
}

0 commit comments

Comments
 (0)