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

Laravel 8/MongoDB - job->release() leads to Call to a member function beginTransaction() on null error #2228

Closed
sodoardi opened this issue Apr 6, 2021 · 0 comments · Fixed by #2229

Comments

@sodoardi
Copy link
Contributor

sodoardi commented Apr 6, 2021

  • Laravel-mongodb Version: 3.8.3
  • Laravel-framework: 8.34.0
  • PHP Version: 7.3.26
  • Database Driver & Version:

Description:

Steps to reproduce

  1. Create & dispatch a Job using MongoDB as queue driver
  2. Call $this->release() in the job
  3. Exception: job->release() leads to "Call to a member function beginTransaction() on null" error

Expected behaviour

Job should be pushed back onto the queue with count of attempts += 1

Actual behaviour

Exception: Call to a member function beginTransaction() on null

Cause

In Laravel 8 the Illuminate\Queue\DatabaseQueue class was updated with changed functionality. Instead of calling $database->release() it nows calls a new method $database->deleteAndRelease() which wraps the delete & release operations into a transaction, I'll try to add a PR later which fixes this in Jenssegers\Mongodb\Queue\MongoQueue by adding an overwrite (like it is already done for deleteReserved() and pop() methods of the DatabaseQueue):

public function deleteAndRelease($queue, $job, $delay)
{
  $this->deleteReserved($queue, $job->getJobId());
  $this->release($queue, $job->getJobRecord(), $delay);
}
Logs: Insert log.txt here (if necessary)
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 a pull request may close this issue.

1 participant