-
-
Notifications
You must be signed in to change notification settings - Fork 210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement enqueue_after_transaction_commit? #1311
Conversation
I'm just not sure how to test it here since this is just an option passed to AJ, and it is being tested there already. Do you have any idea? |
It defines whether the job should be enqueued implicitly after committing an ActiveRecord transaction
51fa814
to
76155bf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's set the default to false
because we do have the option of transactional integrity. Otherwise this looks good 👍
And don't worry about tests. We'll trust Active Job. |
it is worth mentioning that I tested locally with my app, and it worked |
I am scratching my head trying to fix the failure: using Have you seen such a problem? what's your take on this one? There's only one other place where |
hmm. It's not pretty but what about something like this? optional_adapter_kwargs = ActiveJob::QueueAdapters::InlineAdapter.method_defined?(:enqueue_after_transaction_commit?) ? { enqueue_after_transaction_commit?: false } : {}
adapter = instance_double(ActiveJob::QueueAdapters::InlineAdapter, enqueue: nil, enqueue_at: nil, **optional_adapter_kwargs) |
that should do it |
Thanks for all the help on this! I decided to lift it up to a global configuration because the reason why someone would use this---they're using a separate database for jobs---would be a global decision rather than per-Adapter. I'll get this merged and cut a release and unblock you 🚀 |
that’s actually a great idea! thanks for the quick follow up, ben! ❤️ |
Closes #1310
It defines whether the job should be enqueued implicitly after committing an ActiveRecord transaction. More details here