docs: update workers howto for new features#79
Conversation
…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.
|
Warning Rate limit exceeded
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 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. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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
WithSkipOnNotAcquiredguidance plus a caution aboutWithOnNotAcquirederror-driven restarts. - Expand
WorkerInfo/dynamic-children docs withGetHandler,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.
There was a problem hiding this comment.
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
WithSkipOnNotAcquiredguidance plus a warning about restart behavior whenWithOnNotAcquiredreturns a non-nil error. - Expand
WorkerInfodocs withGetHandler/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.
- 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)
There was a problem hiding this comment.
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.ErrSkipTickfor periodic handlers (including an example) and clarify skip vs restart behavior. - Add docs for
WithSkipOnNotAcquired, plus a warning aboutWithOnNotAcquiredcallback error semantics, and noteLockerinterface compatibility. - Expand
WorkerInfoand Dynamic Workers sections withGetHandler, 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.
GetChildCount is present in the API (backed by a map, genuinely cheaper than len(GetChildren()) which allocates a sorted slice).
There was a problem hiding this comment.
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.ErrSkipTickbehavior for periodic workers, with a usage example. - Add
WithSkipOnNotAcquiredusage and clarify the restart/backoff footgun when returning errors fromWithOnNotAcquired. - Expand Dynamic Workers guidance (automatic child cleanup) and add a handler-metadata reconciliation example; update
WorkerInfomethods table (GetHandler,GetChildCount) and noteLockercompatibility.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| | 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 | |
There was a problem hiding this comment.
Fixed — changed to "Treated like return error (not meaningful)" to clarify it's not a no-op for long-running workers.
- 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
There was a problem hiding this comment.
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.ErrSkipTicksemantics (including an example) and add it to the handler return-values table. - Expand distributed lock docs with
WithSkipOnNotAcquiredand clarify the restart footgun whenWithOnNotAcquiredreturns a non-nil error. - Update Dynamic Workers and WorkerInfo sections with automatic child cleanup notes and handler-as-metadata reconciliation example, plus
WorkerInfomethod table updates (GetHandler,GetChildCount) andLockercompatibility note.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
ErrSkipTickto handler return values table with usage exampleGetChild().GetHandler()type assertion)WithSkipOnNotAcquiredconvenience + footgun warning forWithOnNotAcquirederror returnGetHandler,GetChildCountLockerinterface compatibility for existing implementationsCompanion to go-coldbrew/workers#6.
Test plan