laravel-async
laravel-async copied to clipboard
Not working with Laravel Sail
Hello I'm using Laravel Sail. Because I'm Windows user and laravel-async not working with Windows.
When I send async mail, mail not sending. No problem with sync.
My Code:
use Async;
Async::run(function () use ($email, $token) {
Mail::to($email)->send(new ForgotPassword($token));
});
Also not working:
use Async;
for ($i = 1; $i < 20; $i++) {
Async::run(function () use ($i) {
sleep(1);
return $i;
});
}
dd(implode(', ', Async::wait()));
Output: ""
Laravel Version: 8.78 OS: Ubuntu 21 PCNTL Enabled.
# php -i | grep pcntl
pcntl support => enabled
No error with:
Async::run(function () {
}, [
'error' => function (\Exception $e) {
dd($e);
}
]);