Restart.php 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2006-2015 http://thinkphp.cn All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: yunwuxin <448901948@qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace think\queue\command;
  12. use think\Cache;
  13. use think\console\Command;
  14. use think\console\Input;
  15. use think\console\Output;
  16. class Restart extends Command
  17. {
  18. public function configure()
  19. {
  20. $this->setName('queue:restart')->setDescription('Restart queue worker daemons after their current job');
  21. }
  22. public function execute(Input $input, Output $output)
  23. {
  24. Cache::set('think:queue:restart', time());
  25. $output->writeln("<info>Broadcasting queue restart signal.</info>");
  26. }
  27. }