【发布时间】:2018-10-18 00:56:23
【问题描述】:
到目前为止我做了什么:
1) 将队列驱动更新到 .env 中的数据库
2) 我的邮件控制器功能如下:
public function sendEmail()
{
$emailJob = (new SendEmailJob())->delay(Carbon::now()->addSeconds(3));
dispatch($emailJob);
exit();
}
3) SendEmailJob 句柄
public function handle()
{
Mail::to('mail@gmail.com')->send(new SendMailable());
echo 'email sent';
}
4) SendMailable Mail 有以下内容
public function build()
{
return $this->view('emails.ownership');
}
我想在点击 url 后立即发送邮件。
当我以 3 秒的延迟运行 php artisan queue:listen 时,需要很长时间才能采取任何行动。我可以在 0 次尝试的情况下看到作业表上的一些数据。
过了很长时间,命令窗口弹出以下错误
Symfony\Component\Process\Exception\ProcessTimedOutException : The process ""C:\wamp64\bin\php\php7.2.10\php.exe" "artisan" queue:work --once --queue="default" --delay=0 --memory=128 --sleep=3 --tries=0" e
xceeded the timeout of 60 seconds.
at C:\wamp64\www\project\vendor\symfony\process\Process.php:1154
1150|
1151| if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
1152| $this->stop(0);
1153|
> 1154| throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
1155| }
1156|
1157| if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
1158| $this->stop(0);
Exception trace:
1 Symfony\Component\Process\Process::checkTimeout()
C:\wamp64\www\project\vendor\symfony\process\Process.php:383
2 Symfony\Component\Process\Process::wait()
C:\wamp64\www\project\vendor\symfony\process\Process.php:202
通过,可以直接发送邮件的方式没有这个队列的东西。另外,这是强制运行 php artisan queue:listen 的吗?我应该如何在没有 shell 访问权限的服务器上运行它?
【问题讨论】:
标签: laravel laravel-queue