framework icon indicating copy to clipboard operation
framework copied to clipboard

Run after transaction ShouldBeUniqueUntilProcessing job blocks jobs creation on DB transaction failed

Open KolyaSirik opened this issue 2 years ago • 1 comments

  • 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:

  1. Start DB transaction.
  2. Dispatch job with $afterCommit=true and implements ShouldBeUniqueUntilProcessing interface. Job will locked in cache.
  3. Throw exception and rollback transaction.
  4. Start DB transaction.
  5. Dispatch previous job.
  6. Commit transaction.
  7. Job will not dispatched because it still locked in cache.

KolyaSirik avatar Jan 04 '23 10:01 KolyaSirik

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!

github-actions[bot] avatar Jan 05 '23 12:01 github-actions[bot]

@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 avatar Jan 20 '23 13:01 WendellAdriel

@WendellAdriel yes, I fixed this in 8 version by this way

KolyaSirik avatar Feb 15 '23 08:02 KolyaSirik

@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.

WendellAdriel avatar Feb 20 '23 17:02 WendellAdriel

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.

driesvints avatar Apr 03 '23 08:04 driesvints