【发布时间】:2019-09-12 17:13:38
【问题描述】:
我刚刚将自己的维护模式称为 ApplicationMaintenanceMode 扩展了 CheckForMaintenanceMode。
class ApplicationMaintenanceMode extends CheckForMaintenanceMode
{
....
}
并且还扩展了Application类
use Illuminate\Foundation\Application as App;
class Application extends App
{
....
....
public function isApplicationDownForMaintenance()
{
//code
}
}
然后,我也像原来一样创建自己的 DownCommand
class DownCommand extends Command
{
protected $signature = 'app_down {--message= : The message for the maintenance mode. }
{--retry= : The number of seconds after which the request may be retried.}
{--only=* : Routes to be include from maintenance mode.}
{--type=* : Type of maintenance mode.}
{--except=* : Routes to be exclude from maintenance mode.}
{--version_allow= : Application Version allowed.}
{--lock_queue=false : Application Queue need to run or not.}
{--allow=* : IP or networks allowed to access the application while in maintenance mode.}';
}
如您所见 --lock_queue 我想在哪里切换队列工作者可以运行或不运行。目的是在原来的维护模式下,它停止所有的队列。我想要实现的是我希望队列可以在维护模式下轻松切换以运行或不运行。
有什么办法吗?我应该覆盖 QueueManager 和 Worker 类吗?
【问题讨论】:
标签: laravel laravel-5 queue laravel-queue horizon