Skip to content

Commit 7e0c775

Browse files
committed
Add guard to avoid panic
1 parent 3c1ff7f commit 7e0c775

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/planning.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,10 @@ pub async fn distribute_stages(
451451
.collect();
452452

453453
for attempt in 0..3 {
454+
if workers.is_empty() {
455+
return Err(anyhow!("No workers available to distribute stages").into());
456+
}
457+
454458
// all stages to workers
455459
let (task_datas, final_addrs) =
456460
assign_to_workers(query_id, &stages, workers.values().collect())?;

0 commit comments

Comments
 (0)