Skip to content

feat: add build_supervised_worker macro#13

Open
0xgleb wants to merge 1 commit into
feat/job-workerfrom
feat/job-worker-macro
Open

feat: add build_supervised_worker macro#13
0xgleb wants to merge 1 commit into
feat/job-workerfrom
feat/job-worker-macro

Conversation

@0xgleb

@0xgleb 0xgleb commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Every consumer wiring a job worker should get the same concurrency, retry
policy, circuit breaker, and terminal-failure handling without re-deriving it.
ADR-0001 puts that wiring behind a macro in event-sorcery.

Solution

  • build_supervised_worker!(::<Job>, index, backend, input, fail_stop, failure_notify[, injector]) builds a WorkerBuilder with concurrency 1, 3
    retries + RETRY_BACKOFF, a circuit breaker, on_terminal_failure, and the
    work::<J> handler; under test-support it also wires a FailureInjector.
  • The registered worker name is {WORKER_NAME}-{index}.
  • Re-exports Monitor and CircuitBreakerConfig, plus a hidden __apalis
    module holding the apalis items the macro expands to, so consumers need no
    direct apalis dependency.
  • Test: the macro constructs a worker over an in-memory backend.

Closes RAI-916.

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@0xgleb, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 18 minutes and 37 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 27bcd580-116f-4d18-8743-840eb2eeb559

📥 Commits

Reviewing files that changed from the base of the PR and between 6427003 and 359f1aa.

📒 Files selected for processing (3)
  • AGENTS.md
  • crates/event-sorcery/src/job.rs
  • crates/event-sorcery/src/lib.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/job-worker-macro

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.

0xgleb commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add the label add-to-gt-merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@0xgleb 0xgleb self-assigned this Jun 5, 2026
@0xgleb 0xgleb force-pushed the feat/job-worker-macro branch from 6f3cb50 to b90148c Compare June 8, 2026 22:58
@0xgleb 0xgleb force-pushed the feat/job-worker branch 2 times, most recently from 9d7e5dd to 507a496 Compare June 8, 2026 23:41
@0xgleb 0xgleb force-pushed the feat/job-worker-macro branch from b90148c to d69d09d Compare June 8, 2026 23:41
@0xgleb 0xgleb force-pushed the feat/job-worker branch from 507a496 to 39bfec0 Compare June 9, 2026 20:39
@0xgleb 0xgleb force-pushed the feat/job-worker-macro branch from d69d09d to 446da0d Compare June 9, 2026 20:39
@0xgleb 0xgleb mentioned this pull request Jun 9, 2026
@0xgleb 0xgleb force-pushed the feat/job-worker branch from 39bfec0 to fadd787 Compare June 9, 2026 21:22
@0xgleb 0xgleb force-pushed the feat/job-worker-macro branch from 446da0d to 939af23 Compare June 9, 2026 21:22
@0xgleb 0xgleb force-pushed the feat/job-worker branch from fadd787 to c151000 Compare June 9, 2026 23:24
@0xgleb 0xgleb force-pushed the feat/job-worker-macro branch from 939af23 to 7d88999 Compare June 9, 2026 23:24
@0xgleb 0xgleb force-pushed the feat/job-worker-macro branch from 7d88999 to aaae2e8 Compare June 9, 2026 23:55
@0xgleb 0xgleb force-pushed the feat/job-worker-macro branch from aaae2e8 to bc2b9f3 Compare June 10, 2026 01:18
@0xgleb 0xgleb force-pushed the feat/job-worker branch from 20e9663 to cc7e258 Compare June 10, 2026 01:18
@0xgleb 0xgleb marked this pull request as ready for review June 10, 2026 02:08
@0xgleb 0xgleb requested review from JuaniRios and findolor June 10, 2026 02:08
@0xgleb 0xgleb added the enhancement New feature or request label Jun 10, 2026 — with Graphite App
@0xgleb 0xgleb force-pushed the feat/job-worker-macro branch from bc2b9f3 to e8e1064 Compare June 10, 2026 02:50
@0xgleb 0xgleb force-pushed the feat/job-worker branch 2 times, most recently from 6b0d7fe to c7c1f85 Compare June 10, 2026 03:05
@0xgleb 0xgleb force-pushed the feat/job-worker-macro branch from e8e1064 to 7838dd1 Compare June 10, 2026 03:05
@0xgleb 0xgleb changed the base branch from feat/job-worker to graphite-base/13 June 10, 2026 03:30
@0xgleb 0xgleb force-pushed the graphite-base/13 branch from c7c1f85 to ad765a5 Compare June 10, 2026 03:39
@0xgleb 0xgleb force-pushed the feat/job-worker-macro branch from 7838dd1 to 3e4bf23 Compare June 10, 2026 03:39
@0xgleb 0xgleb changed the base branch from graphite-base/13 to feat/job-worker June 10, 2026 03:39
@linear-code

linear-code Bot commented Jun 10, 2026

Copy link
Copy Markdown

RAI-916

@findolor findolor left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved.

@0xgleb 0xgleb force-pushed the feat/job-worker-macro branch from c17bc1b to 71eb78f Compare June 10, 2026 17:39
@0xgleb 0xgleb force-pushed the feat/job-worker branch from ad765a5 to 01e5055 Compare June 10, 2026 17:39
@graphite-app graphite-app Bot force-pushed the feat/job-worker branch from 01e5055 to a0a4629 Compare June 10, 2026 19:18
@graphite-app graphite-app Bot force-pushed the feat/job-worker-macro branch from 71eb78f to 96f8f84 Compare June 10, 2026 19:18
@0xgleb 0xgleb force-pushed the feat/job-worker-macro branch from 96f8f84 to dcd2657 Compare June 12, 2026 19:45
@0xgleb 0xgleb force-pushed the feat/job-worker branch 2 times, most recently from d947c89 to 43fa41e Compare June 12, 2026 21:16
@0xgleb 0xgleb force-pushed the feat/job-worker-macro branch from dcd2657 to 15949ef Compare June 12, 2026 21:16
@0xgleb 0xgleb force-pushed the feat/job-worker-macro branch from 15949ef to 359f1aa Compare June 12, 2026 21:55
@0xgleb 0xgleb force-pushed the feat/job-worker branch from 43fa41e to 6427003 Compare June 12, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants