Skip to content

docs: update workers howto for new features#79

Merged
ankurs merged 7 commits into
mainfrom
docs/workers-feedback-v2
Apr 26, 2026
Merged

docs: update workers howto for new features#79
ankurs merged 7 commits into
mainfrom
docs/workers-feedback-v2

Conversation

@ankurs
Copy link
Copy Markdown
Member

@ankurs ankurs commented Apr 25, 2026

Summary

  • Add ErrSkipTick to handler return values table with usage example
  • Document automatic zombie child cleanup in Dynamic Workers section
  • Add handler-as-metadata reconciler example (config change detection via GetChild().GetHandler() type assertion)
  • Add WithSkipOnNotAcquired convenience + footgun warning for WithOnNotAcquired error return
  • Update WorkerInfo methods table with GetHandler, GetChildCount
  • Note Locker interface compatibility for existing implementations

Companion to go-coldbrew/workers#6.

Test plan

  • Playwright tests pass (navigation + search)
  • Workers howto page loads correctly

…s-metadata

- Add ErrSkipTick to handler return values table with usage example
- Document automatic zombie child cleanup in Dynamic Workers section
- Add handler-as-metadata reconciler example (config change detection
  via GetChild().GetHandler() type assertion)
- Add WithSkipOnNotAcquired convenience + footgun warning for
  WithOnNotAcquired error return
- Update WorkerInfo methods table with GetHandler, GetChildCount
- Note Locker interface compatibility for existing implementations

Companion to go-coldbrew/workers#6.
Copilot AI review requested due to automatic review settings April 25, 2026 14:36
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 25, 2026

Warning

Rate limit exceeded

@ankurs has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 59 minutes and 47 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 59 minutes and 47 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6e56587d-2bff-4d48-a8e7-3396c307d6b9

📥 Commits

Reviewing files that changed from the base of the PR and between 7269c8d and 4dcfe1b.

📒 Files selected for processing (1)
  • howto/workers.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/workers-feedback-v2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Workers how-to documentation to reflect newly added worker/middleware capabilities and recommended usage patterns, aligning docs with recent go-coldbrew/workers feature additions.

Changes:

  • Document workers.ErrSkipTick (including a periodic-handler example) and clarify handler return semantics.
  • Add WithSkipOnNotAcquired guidance plus a caution about WithOnNotAcquired error-driven restarts.
  • Expand WorkerInfo/dynamic-children docs with GetHandler, GetChildCount, and notes on automatic child pruning and handler-based reconciliation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread howto/workers.md
Comment thread howto/workers.md Outdated
Comment thread howto/workers.md Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Workers how-to documentation to reflect newly added worker framework capabilities and safer usage patterns, especially around periodic handler return values, distributed locking, and dynamic child-worker management.

Changes:

  • Document workers.ErrSkipTick (including a periodic-handler usage example) and clarify return-value behavior.
  • Add WithSkipOnNotAcquired guidance plus a warning about restart behavior when WithOnNotAcquired returns a non-nil error.
  • Expand WorkerInfo docs with GetHandler / GetChildCount, plus notes on automatic child cleanup and handler-based metadata inspection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread howto/workers.md
Comment thread howto/workers.md Outdated
Comment thread howto/workers.md Outdated
- Add defer rows.Close() to pollDatabase example
- Fix WithOnNotAcquired wording (callback returns error, not function)
- Rewrite automatic cleanup note with timing caveat
- Simplify handler reference sharing explanation
- Remove GetChildCount from WorkerInfo table (removed from API)
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Workers how-to documentation to reflect newly added worker behaviors and convenience helpers, improving guidance around periodic tick handling, distributed locking, and dynamic child worker management.

Changes:

  • Document workers.ErrSkipTick for periodic handlers (including an example) and clarify skip vs restart behavior.
  • Add docs for WithSkipOnNotAcquired, plus a warning about WithOnNotAcquired callback error semantics, and note Locker interface compatibility.
  • Expand WorkerInfo and Dynamic Workers sections with GetHandler, auto child cleanup behavior, and a handler-as-metadata reconciler example.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread howto/workers.md
GetChildCount is present in the API (backed by a map, genuinely
cheaper than len(GetChildren()) which allocates a sorted slice).
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Workers howto documentation to reflect new workers framework capabilities and safer usage patterns (skip-tick handling, distributed lock conveniences, and richer WorkerInfo introspection), plus guidance for dynamic worker pools.

Changes:

  • Document workers.ErrSkipTick behavior for periodic workers, with a usage example.
  • Add WithSkipOnNotAcquired usage and clarify the restart/backoff footgun when returning errors from WithOnNotAcquired.
  • Expand Dynamic Workers guidance (automatic child cleanup) and add a handler-metadata reconciliation example; update WorkerInfo methods table (GetHandler, GetChildCount) and note Locker compatibility.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread howto/workers.md Outdated
| Return value | Long-running worker (no `Every`) | Periodic worker (with `Every`) |
|---|---|---|
| `return nil` | Worker stops permanently | Cycle succeeded — next tick fires |
| `return workers.ErrSkipTick` | No effect (not meaningful) | Tick skipped — next tick fires normally |
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed — changed to "Treated like return error (not meaningful)" to clarify it's not a no-op for long-running workers.

Comment thread howto/workers.md
- Return values table: "No effect" → "Treated like return error" for
  ErrSkipTick in long-running workers (it's not a no-op)
- pollDatabase example: check ctx.Err() before returning ErrSkipTick
  so context cancellation triggers clean shutdown, not a skip
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Workers how-to documentation to reflect new framework features and APIs (e.g., skip-tick behavior, distributed lock convenience options, and richer child/handler introspection), aligning the docs with the latest go-coldbrew/workers capabilities.

Changes:

  • Document workers.ErrSkipTick semantics (including an example) and add it to the handler return-values table.
  • Expand distributed lock docs with WithSkipOnNotAcquired and clarify the restart footgun when WithOnNotAcquired returns a non-nil error.
  • Update Dynamic Workers and WorkerInfo sections with automatic child cleanup notes and handler-as-metadata reconciliation example, plus WorkerInfo method table updates (GetHandler, GetChildCount) and Locker compatibility note.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread howto/workers.md Outdated
@ankurs ankurs merged commit b981817 into main Apr 26, 2026
7 checks passed
@ankurs ankurs deleted the docs/workers-feedback-v2 branch April 26, 2026 14: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