想要处理推送队列上的任务,可以像处理一般的队列一样使用 Queue::push 方法。Failed JobsSince things don't always go as planned, sometimes your queued jobs will fail. Don't worry, it happens to the best of us! Laravel includes a convenient way to specify the maximum number of times a job...
However, you may specify the number of minutes such a job should be delayed by calling the backoff method when attaching the middleware to the job:use Illuminate\Queue\Middleware\ThrottlesExceptions; /** * Get the middleware the job should pass through. * * @return array */ public function...
However, you may specify the number of minutes such a job should be delayed by calling the backoff method when attaching the middleware to the job:use Illuminate\Queue\Middleware\ThrottlesExceptions;/** * Get the middleware the job should pass through. * * @return array<int, object> */...
Any overlapping jobs of the same type will be released back to the queue. You may also specify the number of seconds that must elapse before the released job will be attempted again:/** * Get the middleware the job should pass through. * * @return array<int, object> */ public ...
Specifying Queue Sleep Duration In addition, you may specify the number of seconds to wait before polling for new jobs: phpartisanqueue:listen--sleep=5 Note that the queue only "sleeps" if no jobs are on the queue. If more jobs are available, the queue will continue to work them without...
php artisan queue:work--tries=3 不过,你还可以在任务类自身定义最大失败次数来实现更加细粒度的控制,如果最大失败次数在任务中指定,则其优先级高于命令行指定的数值: <?phpnamespaceApp\Jobs;classProcessPodcastimplementsShouldQueue{/** * The number of times the job may be attempted. ...
connections配置项包含了Laravel支持的所有队列驱动,我们使用Redis驱动,所以需要配置redis项:connection对应config/database.php中redis的default配置;queue为默认队列名称;expire为队列任务过期时间(秒)。这里我们可以保持其默认配置不变。
因此在正式环境中我们更倾向于使用多个queue:work并行执行异步队列中的任务。queue:work只是读取队首的一项任务,执行完成后即结束程序,如果没有任务也会结束程序。这个方式类似于PHP对于WEB请求的处理,不会出现内存泄露。 利用Supervisor可以便捷的创建基于queue:work的异步队列并行处理。
可以是 virtualbox, vmware_fusion, vmware_workstation, parallels 或者 hyperv provider: virtualbox共享文件夹folders属性用于配置本地和homestead环境的同步文件夹。 由于多站点或项目有太多文件而导致性能变差时候,可以设置不同的文件夹来同步不同的项目。 NFS也可以用来优化性能,windows 不支持。使用NFS时,安装...
php artisan queue:work 注:为了保持队列进程 queue:work 持续在后台运行,需要使用进程守护程序,比如 Supervisor 来确保队列进程持续运行。 简单处理可以使用 php artisan queue:work --daemon & 10、运行队列监听器 开始进行队列监听 laravel 包含了一个 Artisan 命令来运行推送到队列中的任务的执行。你可以使用 queue...