Repository navigation
docs(messagequeue): correct worker stop behavior in MySQL subscriber README - #1162
Conversation
sbalabanov
left a comment
There was a problem hiding this comment.
[mqdoc-1-reviewer] round 1/5: changes needed, one must-fix.
Bullet 1 (the caller does not wait; stopping cancels the context and removes the map entry) matches stopPartitionWorker and stopAllWorkers on main. The ordering in bullet 2 also holds: workerWg.Add(1) comes before go w.run, run defers workerWg.Done(), the worker's send on deliveryCh selects on ctx.Done(), and managePartitions calls workerWg.Wait() before close(deliveryCh). sub.done closes only after that wait, by the deferred close on main and the explicit close just before deliveryCh in #1161. So the ordering stays correct after #1161 too. What is wrong is the claim that Close() waits without a bound (inline comment). The README follows the prose, no-type-definitions and no-hard-wrap rules.
03c5e9c to
ad0b27e
Compare
sbalabanov
left a comment
There was a problem hiding this comment.
[mqdoc-1-reviewer] round 2/5: no outstanding comments; the round 1 must-fix is resolved.
The only change from 03c5e9c to ad0b27e is the workerWg bullet in Worker Stop Behavior. The PR still touches only platform/extension/messagequeue/mysql/README.md. Checked the new wording against subscriber.go on main (1eeb2ae) and against #1161 (1fde991):
workerWg:Add(1)comes beforego w.run, andrundefersDone().managePartitionscallsworkerWg.Wait()beforeclose(deliveryCh), so no worker can send on a closed channel.- "
Close()waits up to 30s per subscription for this":Closestarts a newshutdownTimeouttimer for each subscription (defaultsubscriptionShutdownTimeout= 30s) and waits onsub.done.sub.donecloses only afterworkerWg.Wait(): on main through the deferred close, and with #1161 explicitly just beforedeliveryCh. #1161 does not change theClosewait loop. - On timeout
Closeadds an error to its return value and moves on, and the supervisor and its workers finish asynchronously, as theClosedoc comment says.
The bullet still follows the README rules: prose, no type-definition blocks, no hard wrapping.
…README Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ad0b27e to
236a4c1
Compare
|
|
Summary
The Worker Stop Behavior section of the MySQL queue README claimed the caller waits up to 30s for worker exit.
stopPartitionWorkeronly cancels the worker context and removes it from the workers map; it never waits.Changes
workerWgis awaited bymanagePartitionson shutdown before closing the delivery channel, which is whyClose()does not return until workers exit.Test Plan
Docs-only.
make lintpasses.🤖 Generated with Claude Code