问题描述
我们的laravel应用程序中有多个作业。当前,所有作业都立即排队,并且一个接一个地执行。我希望该特定作业以低优先级执行,这意味着在该作业之后是否应该执行其他任何作业。
BulkPdfPrintLabel::withChain([
new MergeLabel($filepath,$manifest_id,$last,$user_id,$user_type)
])->dispatch($consignments,$user_type,$filepath);
解决方法
改为使用此代码:
// This job is sent to the default queue that you selected in config/app file
BulkPdfPrintLabel::withChain([
new MergeLabel($filepath,$manifest_id,$last,$user_id,$user_type)])
->dispatch($consignments,$user_type,$filepath);
更新
// This job is sent to the "low" queue.("low" is custom and you can change it)
BulkPdfPrintLabel::withChain([
new MergeLabel($filepath,$user_type)->onQueue("low")
])
->dispatch($consignments,$filepath);
然后运行此命令来为您的默认队列设置高优先级:
php artisan queue:work --queue=high,default