Skip to content

Support recurring jobs that defer enqueuing to after commit always #290

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

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

rosa
Copy link
Member

@rosa rosa commented Aug 21, 2024

These need to be enqueued within the transaction that creates the recurring execution to avoid duplicate runs. However, if the job is set to enqueue_after_transaction_commit = :always or :default when we change the default, it won't work because we'll try to create the recurring execution without having actually enqueued the job. With this change, we bypass Active Job's enqueuing and enqueue directly with Solid Queue, running enqueue callbacks.

These need to be enqueued within the transaction that creates the
recurring execution to avoid duplicate crons. However, if the job is
set to `enqueue_after_transaction_commit = :always` or :default when we
change the default, it won't work because we'll try to create the
recurring execution without having actually enqueued the job. With this
change, we bypass Active Job's enqueuing and enqueue directly with Solid
Queue, running enqueue callbacks.
@rosa rosa force-pushed the fix-cron-jobs-enqueue-after-transaction-commit branch from 58d0cef to e6a314c Compare August 21, 2024 14:22
@rosa rosa merged commit 0c81c77 into main Aug 21, 2024
8 checks passed
@rosa rosa deleted the fix-cron-jobs-enqueue-after-transaction-commit branch August 21, 2024 15:59
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.

1 participant