Skip to content

Commit d5cc2fe

Browse files
committed
samples: workflow_streams: drop force_flush=True from charge_card
The activity's final publish was using force_flush=True, which sets the flush_event so the background flusher fires immediately. Triggering a flush right before __aexit__ runs the activity into the WorkflowStreamClient's cancel-mid-flush path: __aexit__ cancels the flusher task while it's awaiting the publish signal RPC, the cancel propagates into the in-flight signal, and the activity hangs until the StartToClose timeout fires. Empirically the workflow then retries the activity indefinitely. Without force_flush=True the buffered "card charged" event flushes via the regular 200ms batch interval and the flusher is sleeping in wait_for(...) when __aexit__ cancels it — a clean cancellation path. The user-visible publish ordering is unchanged. The underlying SDK bug should be fixed separately by switching __aexit__ from cancel() to a cooperative-stop flag so the in-flight signal completes before the flusher exits.
1 parent 0962379 commit d5cc2fe

1 file changed

Lines changed: 0 additions & 1 deletion

File tree

workflow_streams/activities/payment_activity.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,5 @@ async def charge_card(order_id: str) -> str:
2626
await asyncio.sleep(1.0)
2727
progress.publish(
2828
ProgressEvent(message="card charged"),
29-
force_flush=True,
3029
)
3130
return f"charge-{order_id}"

0 commit comments

Comments
 (0)