From 61405b3d0061b3baeceacab8fade6991c6ff4324 Mon Sep 17 00:00:00 2001 From: Simo Lin Date: Fri, 19 Dec 2025 13:49:51 -1000 Subject: [PATCH] [model-gateway] Run workflow event subscribers concurrently (#15504) --- sgl-model-gateway/src/workflow/event.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sgl-model-gateway/src/workflow/event.rs b/sgl-model-gateway/src/workflow/event.rs index a21aaad75..84522841e 100644 --- a/sgl-model-gateway/src/workflow/event.rs +++ b/sgl-model-gateway/src/workflow/event.rs @@ -74,12 +74,11 @@ impl EventBus { self.subscribers.write().await.push(subscriber); } - /// Publish an event to all subscribers + /// Publish an event to all subscribers concurrently pub async fn publish(&self, event: WorkflowEvent) { let subscribers = self.subscribers.read().await; - for subscriber in subscribers.iter() { - subscriber.on_event(&event).await; - } + let futures: Vec<_> = subscribers.iter().map(|s| s.on_event(&event)).collect(); + futures::future::join_all(futures).await; } }