Skip to content

Commit 6ec648e

Browse files
committed
fix(notify): use publishAndTrack for DomainEvent co-publish in NotifyAction
The DomainEvent co-publish for binary mode used EventBus.publish() (fire-and-forget), which creates untracked Tasks not counted by inFlightHandlers. As a result, awaitPendingEvents() returned immediately and the binary exited before all notification handlers completed — causing intermittent missing output on Linux (faster GCD scheduling than macOS). Switch to publishAndTrack() so each DomainEvent handler runs to completion before NotifyAction moves to the next item in the collection. This ensures awaitPendingEvents() correctly accounts for the in-flight handlers.
1 parent 15a7b39 commit 6ec648e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/ARORuntime/Actions/BuiltIn/ResponseActions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ public struct NotifyAction: ActionImplementation {
11011101
payload["user"] = item
11021102
payload[target] = item
11031103
}
1104-
EventBus.shared.publish(DomainEvent(eventType: "NotificationSent", payload: payload))
1104+
await EventBus.shared.publishAndTrack(DomainEvent(eventType: "NotificationSent", payload: payload))
11051105
}
11061106
} else {
11071107
for item in items {

0 commit comments

Comments
 (0)