mirror of
https://github.com/versity/versitygw.git
synced 2026-09-23 08:24:17 +00:00
Detach queued work under the publication mutex and execute the sinks after releasing it: the overflow servicing and the shutdown drain now swap out the pending list inside the critical section and publish outside, so a slow sink delays its own records but never blocks a dispatcher or a native terminal callback. Move the worker-stopped transition under the same mutex. The worker marks itself stopped before emptying the channel and the overflow list, and dispatchers test that flag rather than the done channel inside the critical section, closing the window where an append could land between the sweep completing and the deferred channel close only to be stranded. Give the metrics manager its own cancellation. The forwarder terminates through a child context the manager derives and cancels in Close, so a standalone use of the API shuts down without relying on an external context being canceled.