You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following lines of code in QueueTenancyBootstrapper.php appear to be invalid. When you use queue:work to run a queued job, the constructor of this class is called.
The constructor in turn calls $this->setUpPayloadGenerator().
The payload generator includes the code aforementioned:
protectedfunctionsetUpPayloadGenerator()
{
$bootstrapper = &$this;
if (! $this->queue instanceof QueueFake) {
$this->queue->createPayloadUsing(function ($connection) use (&$bootstrapper) {
// we never get here because the createPayloadUsing() method doesn't exist on `$this->queue` object. // it exists on \Illuminate\Queue\Queue or \Illuminate\Support\Facades\Queue facadereturn$bootstrapper->getPayload($connection);
});
}
}
The $this->queue->createPayloadUsing() closure is never executed because the createPayloadUsing() method doesn't exist on the $this->queue class.
In the constructor, we see that $this->queue is an instance of use Illuminate\Queue\QueueManager. This class does not have the createPayloadUsing() method. Instead, it is available on the Illuminate\Queue\Queue class as seen here.
Steps to reproduce
Install the Tenancy package.
In QueueTenancyBootstrapper, put dd('here') inside the closure at $this->queue->createPayloadUsing().
Dispatch a queued job or event inside your code, to be run in a tenant context.
Run php artisan queue:work
The dumped string will never output because the code never reaches that point.
Alternatively,
put get_class_methods($this->queue) on the line just after if (! $this->queue instanceof QueueFake).
run php artisan queue:work
a list of methods will be displayed but it will not include createPayloadUsing()
Expected behavior
The job should dispatch and execute when queue:work is used.
Laravel version
10.48.22
stancl/tenancy version
3.8.5
The text was updated successfully, but these errors were encountered:
I don't really get this issue. Are you commenting on the implementation or reporting a bug? Say what doesn't work for you as expected.
The following lines of code in QueueTenancyBootstrapper.php appear to be invalid. When you use queue:work to run a queued job, the constructor of this class is called.
Pretty sure that's irrelevant. The code you're talking about affects payload creation, which happens before jobs are being processed by the queue worker. This logic running in queue:work doesn't really do anything.
The $this->queue->createPayloadUsing() closure is never executed because the createPayloadUsing() method doesn't exist on the $this->queue class.
That would throw an exception, not silently fail.
In the constructor, we see that $this->queue is an instance of use Illuminate\Queue\QueueManager. This class does not have the createPayloadUsing() method. Instead, it is available on the Illuminate\Queue\Queue class as seen here.
Bug description
The following lines of code in QueueTenancyBootstrapper.php appear to be invalid. When you use queue:work to run a queued job, the constructor of this class is called.
The constructor in turn calls
$this->setUpPayloadGenerator()
.The payload generator includes the code aforementioned:
The
$this->queue->createPayloadUsing()
closure is never executed because the createPayloadUsing() method doesn't exist on the$this->queue
class.In the constructor, we see that
$this->queue
is an instance ofuse Illuminate\Queue\QueueManager
. This class does not have thecreatePayloadUsing()
method. Instead, it is available on the Illuminate\Queue\Queue class as seen here.Steps to reproduce
dd('here')
inside the closure at$this->queue->createPayloadUsing()
.php artisan queue:work
Alternatively,
get_class_methods($this->queue)
on the line just afterif (! $this->queue instanceof QueueFake)
.php artisan queue:work
createPayloadUsing()
Expected behavior
The job should dispatch and execute when queue:work is used.
Laravel version
10.48.22
stancl/tenancy version
3.8.5
The text was updated successfully, but these errors were encountered: