JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources

`after_commit` callback?

Open
#503 18 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Enhancement
Dominant language
Ruby
Stars
2.3k
Forks
546
PR merge metrics
No merged PRs in 30d

Description

I'm running into an issue where I'm sending a job to RabbitMQ in an after_create callback on a resource, and sometimes the job gets picked up for work before the transaction to create the record has committed. Is there anything analogous to an after_commit callback?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how the resource's after_create callback is handled and how it interacts with the transaction lifecycle; the issue does not name a file or test. Compare the desired behavior with Rails after_commit semantics and RabbitMQ job dispatch. Done means jobs are not picked up until the record-creating transaction has committed, with regression coverage for that ordering.

Written by the indexing model from the issue text.

Assessment

Tech stack
rabbitmq, rails, ruby
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.