Skip to content

feat: add queue action hooks#1

Open
mikehostetler wants to merge 1 commit into
bedrock-kv:mainfrom
mikehostetler:intent-ledger/action-hooks
Open

feat: add queue action hooks#1
mikehostetler wants to merge 1 commit into
bedrock-kv:mainfrom
mikehostetler:intent-ledger/action-hooks

Conversation

@mikehostetler

Copy link
Copy Markdown

Summary

  • add an optional on_action hook to Bedrock.JobQueue configuration
  • thread the hook through the consumer supervisor and manager
  • invoke the hook inside the same transaction as queue complete/requeue/snooze actions
  • normalize hook return values so queue behavior remains compatible

Tests

  • mix format --check-formatted && mix test

Supports intent-ledger-28h.3
Store.requeue(state.repo, state.root, lease, base_delay: delay_ms, max_delay: delay_ms)
end

with :ok <- normalize_queue_result(queue_result),

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.

blocking if this PR merges independently: when run_action_hook/5 returns {:error, reason}, this with returns an error tuple from inside repo.transact/1; Bedrock commits returned values unless repo.rollback/1 is called. PR #2 adds the rollback path, so I would either merge these as a stack or pull that rollback handling into this PR before merging #1.

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.

3 participants