Пример #1
0
 public function run($command)
 {
     switch ($command) {
         case 'track':
         case 'untrack':
             $jid = $_REQUEST['jid'];
             return json_decode($this->client->lua->run('track', [$command, $jid]), true);
         case 'retry':
             return $this->retryJob($_REQUEST['jid']);
         case 'retryAll':
             return $this->retryAllJobs($_REQUEST['group']);
         case 'cancel':
             return $this->client->cancel($_REQUEST['jid']);
         case 'cancelAll':
             return $this->cancelAllJobs($_REQUEST['group']);
         case 'timeout':
             $this->client->timeout($_REQUEST['jid']);
             return true;
         case 'move':
             $this->retryJob($_REQUEST['jid'], $_REQUEST['queue']);
             return true;
         case 'priority':
             $this->client->lua->run('priority', [$_REQUEST['jid'], $_REQUEST['priority']]);
             return true;
         case 'tag':
             $this->client->lua->run('tag', ['add', $_REQUEST['jid'], $_REQUEST['tag']]);
             return true;
         case 'untag':
             $this->client->lua->run('tag', ['remove', $_REQUEST['jid'], $_REQUEST['untag']]);
             return true;
     }
     throw new \Exception('Invalid command: ' . $command);
 }