framework
framework copied to clipboard
Run after transaction ShouldBeUniqueUntilProcessing job blocks jobs creation on DB transaction failed
- Laravel Version: 9.46.0
- PHP Version: 8.1.1
- Database Driver & Version: MySQL 8.0.23
Description:
Run after transaction ShouldBeUniqueUntilProcessing job blocks jobs creation on DB transaction failed
Steps To Reproduce:
- Start DB transaction.
- Dispatch job with $afterCommit=true and implements ShouldBeUniqueUntilProcessing interface. Job will locked in cache.
- Throw exception and rollback transaction.
- Start DB transaction.
- Dispatch previous job.
- Commit transaction.
- Job will not dispatched because it still locked in cache.
Thank you for reporting this issue!
As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.
If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.
Thank you!
@KolyaSirik @driesvints I started working on something, but IDK if it's the best approach or if it should be something completely diff. I pushed a commit here. If someone could take a look and say if I'm moving in the right direction or not it would be great. Since this is my first time checking this side of the framework code I could be completely wrong, I'm just giving it a shot here. I would appreciate any feedback/help.
@WendellAdriel yes, I fixed this in 8 version by this way
@KolyaSirik in the commit I sent I'm having issues making a test suite to properly test this. I think the solution is already working but I'm not sure the best way to handle this in a test suite.
Closing this issue because it's inactive, already solved, old or not relevant anymore. Feel to open up a new issue if you're still experiencing this.