简体   繁体   English

Laravel队列不起作用

[英]Laravel Queue not work

I used laravel 5 and Queue. 我使用了laravel 5和Queue。 try this 尝试这个

$job = (new InstallTheme())->onQueue('install_theme')->delay(20);
            dispatch($job); 

not work 不行

$job = (new InstallTheme())->delay(20);
        dispatch($job);

work 工作

Why the first option does not work? 为什么第一个选项不起作用?

upd laravel work only if fuild "queue" in table 'jobs' = default 仅当表“ jobs”中的“ queue”“队列” =默认值时,upd laravel才能工作

how to fix this? 如何解决这个问题?

i think setting queue.php ? 我认为设置queue.php吗?

'database' => [
            'driver' => 'database',
            'table' => 'jobs',
            'queue' => 'default',
            'retry_after' => 90,
        ],

As I recall 据我回忆

$job = (new InstallTheme())->onQueue('install_theme')->delay(20);
            dispatch($job); 

puts the job into the install_theme queue while your other code puts it into the default queue. 将作业放入install_theme队列中,而其他代码则将其放入默认队列中。 Please try to run the queue worker with this parameters. 请尝试使用此参数运行队列工作器。

php artisan queue:work --queue=install_theme

This should specifically process the job from this queue. 这应该专门处理此队列中的作业。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM