docs(worker): state that residual events are discarded after WorkerShutdown (mxaccessgw#183)

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
Joseph Doherty
2026-11-09 12:31:56 -05:00
parent ad7d2cbef0
commit 9906d7e57c
+10
View File
@@ -1025,6 +1025,16 @@ Graceful shutdown sequence:
If shutdown wedges, the gateway kills the process. The worker should be written If shutdown wedges, the gateway kills the process. The worker should be written
so process kill does not corrupt other sessions. so process kill does not corrupt other sessions.
**Residual events are discarded (v1 behavior).** The worker has no final event
flush. The event-drain loop runs concurrently with the shutdown steps above, so
events that it frames before the message loop exits are delivered, but the loop
is cancelled as soon as the shutdown ack has been written and the message loop
returns. Events still queued in the worker's event queue at that point, and any
event raised after the ack, are discarded with the session; they are not framed
and not sent to the gateway. A caller that needs the last events of a session
must drain them (`DrainEvents`, or consume the event stream) before requesting
shutdown.
### Ending the pipe read (net48) ### Ending the pipe read (net48)
Step 8 above cannot be done by cancellation. On .NET Framework 4.8 Step 8 above cannot be done by cancellation. On .NET Framework 4.8