| 1 | <?php |
||
| 11 | trait CommandTrait |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * Delay before getting jobs |
||
| 15 | * |
||
| 16 | * @var int |
||
| 17 | */ |
||
| 18 | public $delay = 0; |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Maximum memory usage |
||
| 22 | * |
||
| 23 | * @var int |
||
| 24 | */ |
||
| 25 | public $memory = 128; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Sleep before getting new jobs |
||
| 29 | * |
||
| 30 | * @var int |
||
| 31 | */ |
||
| 32 | public $sleep = 3; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Max tries to run job |
||
| 36 | * |
||
| 37 | * @var int |
||
| 38 | */ |
||
| 39 | public $maxTries = 1; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * Daemon timeout |
||
| 43 | * |
||
| 44 | * @var int |
||
| 45 | */ |
||
| 46 | public $timeout = 60; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Queue name |
||
| 50 | * |
||
| 51 | * @var string |
||
| 52 | */ |
||
| 53 | public $queue = 'default'; |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Connection name |
||
| 57 | * |
||
| 58 | * @var string |
||
| 59 | */ |
||
| 60 | public $connection = 'default'; |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Available options |
||
| 64 | * |
||
| 65 | * @param string $actionId |
||
| 66 | * |
||
| 67 | * @return array |
||
| 68 | */ |
||
| 69 | public function options($actionId) |
||
| 73 | |||
| 74 | /** |
||
| 75 | * Process job by id and connection |
||
| 76 | */ |
||
| 77 | public function actionProcess($id) |
||
| 83 | |||
| 84 | /** |
||
| 85 | * Process the job |
||
| 86 | * |
||
| 87 | * @param $connectionName |
||
| 88 | * @param $id |
||
| 89 | * |
||
| 90 | * @return array|null |
||
| 91 | */ |
||
| 92 | protected function processJob($connectionName, $id) |
||
| 109 | } |
||
| 110 |