Laravel-完成工作时的页面很忙
我试图将工作发送到队列。
控制器
public function play($id, Request $request)
{
ProcessResult::dispatch($id);
dd ('done');
作业
public function handle()
{
sleep(25) {
代码工作还不错,但是:
- “工作”表是空的;
- 浏览器中的页面很忙,直到作业未完成为止;
- 直到工作未完成之前,DD('DONE')才到达;
驱动程序是Localhost上的数据库。 Laravel 9。
可能是一个错误或对队列逻辑的普遍误解?
Im trying to send a job to the queue.
Controller
public function play($id, Request $request)
{
ProcessResult::dispatch($id);
dd ('done');
Job
public function handle()
{
sleep(25) {
Code works is fine, but:
- 'jobs' table is empty;
- page in browser is busy until job is not completed;
- dd('done') is not arrived until job is not completed;
Driver is database on localhost. Laravel 9.
What could be a mistake or a general misunderstanding of the logic of the queues?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题是您的工作没有排队。您必须设置一些事情才能按照您想要的方式工作。首先,您必须在工作文件中执行以下操作
,之后您必须安装 suppprocisor 并设置一些东西。您可以找到有关如何保持Laravel队列在此线程中运行的更多信息
。 >如何保持Laravel队列系统在服务器上运行
Your problem is that your job is not queued. There are a few things that you must set up in order this to work the way you want. First of all, you must do the following in your job file
After that you must install supervisor and set up some things. You can find more information for how to keep laravel queue running in this thread
How to keep Laravel Queue system running on server