Skip to content
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

[11.x] Allow SyncQueue to dispatch jobs after a transaction is committed #48860

Merged

Conversation

mateusjatenee
Copy link
Contributor

While testing #48705 we discovered that the sync driver doesn't support pushing jobs after a transaction commits — that's because it's push implementation is different from "real" queue drivers.

This PR adds that functionality to sync. I personally don't think it's a big deal because I imagine most people are using real queue drivers, but I think it's good to have them all behave the same.
Although there are no contract changes, I targeted 11.x since it changes existing behavior.

@mateusjatenee mateusjatenee force-pushed the bugfix/sync-queue-after-commit-11 branch from 350bf9b to 69b661b Compare October 30, 2023 15:35
@mateusjatenee mateusjatenee marked this pull request as ready for review October 30, 2023 15:40
@taylorotwell taylorotwell merged commit 444141b into laravel:master Nov 1, 2023
16 checks passed
hansnn added a commit to hansnn/laravel-framework that referenced this pull request Apr 15, 2024
AfterCommit support was added to the SyncQueue in laravel#48860. However, it only works if the job in question implements the ShouldQueueAfterCommit interface or sets the afterCommit property - it does not work if after_commit is set to true in the sync driver's configuration. This makes the behavior inconsistent, which is what this commit solves by also considering the after_commit config.
taylorotwell added a commit that referenced this pull request Apr 15, 2024
* Consider after_commit config in SyncQueue

AfterCommit support was added to the SyncQueue in #48860. However, it only works if the job in question implements the ShouldQueueAfterCommit interface or sets the afterCommit property - it does not work if after_commit is set to true in the sync driver's configuration. This makes the behavior inconsistent, which is what this commit solves by also considering the after_commit config.

* Update SyncQueue.php

* Update SyncQueue.php

---------

Co-authored-by: Taylor Otwell <[email protected]>
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.

2 participants