lucid
lucid copied to clipboard
Laravel 10 upgrade
In laravel 10, I think Jobs now respond with Illuminate\Foundation\Bus\PendingDispatch
objects rather than the response of what the handle method has.
In feature:
$this->run(GenerateUUIDJob::class);
now responds with
Illuminate\Foundation\Bus\PendingDispatch^ {#9196 // app/Models/Traits/HasUuid.php:36
#job: App\Domains\Uid\Jobs\GenerateUUIDJob^ {#9197}
#afterResponse: false
}
instead of the response of what the handle method does:
class GenerateUUIDJob extends Job
{
public function __construct()
{
}
public function handle(): string
{
return Str::orderedUuid();
}
}
Support for Laravel 10 would be really appreciated...
https://github.com/lucidarch/lucid/pull/49
Please refer to this PR to solve the problem with Laravel 10.x
Feel free to use my fork https://github.com/ksimenic/lucid. It has all optimizations for Laravel 10.
All you need to do is to add following in your composer.json
"repositories": [
{
"type": "vcs",
"url": "https://github.com/ksimenic/lucid"
}
],
and then require
"lucidarch/lucid": "dev-latest"
@ksimenic we are currently using your fork in combination with laravel 10; but are running into an issue where that all jobs and operation that have the ShouldQueue
interface are still executed on the sync queue.
That's caused by this little piece of code: https://github.com/laravel/framework/blob/11.x/src/Illuminate/Bus/Dispatcher.php#L92 that always forces execution to the sync queue.
Any idea what the best option would be to get the 'old' behaviour back?
Using the runInQueue
method from the UnitDispatcher
currently requires me to override the 3rd argument in all calls because we use different queue names compared to the name 'default'
Alright, have looked, but the least impact way in my option will be to alter the UnitDispatcher on line 58:
$result = $this->dispatchSync($unit);
}
to:
if ($unit instanceof ShouldQueue) {
return $this->dispatch($unit);
}
$result = $this->dispatchSync($unit);
}
Have created a pull request for this https://github.com/ksimenic/lucid/pull/4