-
Notifications
You must be signed in to change notification settings - Fork 8
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
Jobs with transactions within them cause this package to infinitely loop #3
Comments
Are you using sync driver for jobs? |
On my local environment, yes. I haven't put the code up anywhere to test on an alternate driver |
I've had an experiment, and replacing TransactionalDispatcher.php line 35 like this seems to resolve the issue, but I'm unsure as to knock on impact of overriding Laravel's singleton pattern. - $this->db = $container->make('db');
+ $this->db = clone $container->make('db'); |
I think the issue is because you are using sync queue. |
Yeah, works fine on the redis queue driver, will just crack on with the "it'll work up on the other environments" for now, thanks :) |
Fixed in 0.4.0 |
Laravel 5.7
If the job being dispatched also contains a transaction, this gets stuck in a loop and eventually errors with
Maximum function nesting level of '512' reached, aborting!
Example:
MyService.php
DummyJobWithTransaction.php
In tinker:
Output in logs:
Presumably the issue is related to the fact that Laravel's DB is a singleton, so as soon as a fresh transaction opens, the TransactionalDispatcher starts waiting for the commit.
The text was updated successfully, but these errors were encountered: