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 previous behavior, it was directly calling app(Dispatcher::class)->dispatch($this->job);, which if you are using the Database Queue Driver, it returns the id of the jobs table. (not sure about other drivers).
If you would like to dispatch a job that runs immediately and returns a value from the handle method, you should use the dispatch_now or Bus::dispatchNow method to dispatch the job:
Description:
The behavior changed here: 91f5357#diff-12ace36c0bee81cc87f38273d5fe2a07R376
The previous behavior, it was directly calling
app(Dispatcher::class)->dispatch($this->job);
, which if you are using theDatabase Queue Driver
, it returns theid
of thejobs
table. (not sure about other drivers).Now it's creating a
PendingDispatch
object, which only dispatches the job on__destruct
(https://github.com/laravel/framework/blob/5.6/src/Illuminate/Foundation/Bus/PendingDispatch.php#L110-L113), so no way for getting theid
from thejobs
table using this helper anymore.I thought about adding a way for early dispatching it, something like:
src/Illuminate/Foundation/Bus/PendingDispatch.php
But not sure it's a good solution... for now i'm going to call
app(Dispatcher::class)->dispatch($job)
directly on my code.Another option would be add a second param here: https://github.com/laravel/framework/blob/5.6/src/Illuminate/Foundation/helpers.php#L381-L385
Like,
$pending = true
, or something like that.The text was updated successfully, but these errors were encountered: