Skip to content

docs(messagequeue): correct worker stop behavior in MySQL subscriber README - #1162

Merged
sbalabanov merged 1 commit into
mainfrom
docs/mq-worker-stop-behavior
Dec 2, 2026
Merged

sbalabanov merged 1 commit into
mainfrom
docs/mq-worker-stop-behavior

Conversation

@sbalabanov

Copy link
Copy Markdown
Collaborator

Summary

The Worker Stop Behavior section of the MySQL queue README claimed the caller waits up to 30s for worker exit. stopPartitionWorker only cancels the worker context and removes it from the workers map; it never waits.

Changes

  • Replace the 30s-wait bullet with the actual non-blocking behavior.
  • Clarify that workerWg is awaited by managePartitions on shutdown before closing the delivery channel, which is why Close() does not return until workers exit.

Test Plan

Docs-only. make lint passes.

🤖 Generated with Claude Code

@sbalabanov sbalabanov left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

@sbalabanov
sbalabanov force-pushed the docs/mq-worker-stop-behavior branch from 03c5e9c to ad0b27e Compare December 1, 2026 23:54

@sbalabanov sbalabanov left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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 before go w.run, and run defers Done(). managePartitions calls workerWg.Wait() before close(deliveryCh), so no worker can send on a closed channel.
  • "Close() waits up to 30s per subscription for this": Close starts a new shutdownTimeout timer for each subscription (default subscriptionShutdownTimeout = 30s) and waits on sub.done. sub.done closes only after workerWg.Wait(): on main through the deferred close, and with #1161 explicitly just before deliveryCh. #1161 does not change the Close wait loop.
  • On timeout Close adds an error to its return value and moves on, and the supervisor and its workers finish asynchronously, as the Close doc comment says.

The bullet still follows the README rules: prose, no type-definition blocks, no hard wrapping.

@sbalabanov
sbalabanov marked this pull request as ready for review December 1, 2026 23:55
@sbalabanov
sbalabanov requested review from a team as code owners December 1, 2026 23:55
…README

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@sbalabanov
sbalabanov force-pushed the docs/mq-worker-stop-behavior branch from ad0b27e to 236a4c1 Compare December 2, 2026 21:20
@cla-assistant

cla-assistant Bot commented Dec 2, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@sbalabanov
sbalabanov merged commit 700ed40 into main Dec 2, 2026
20 of 21 checks passed
@sbalabanov
sbalabanov deleted the docs/mq-worker-stop-behavior branch December 2, 2026 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants