Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Обработка ачивок через worker jobs
- * @param int $loop
- * @param int $loopSleep
- */
- public function actionJobber($loop=0, $loopSleep=5)
- {
- do {
- $queue = $this->module->getQueue();
- $worker = $this->module->getWorker();
- $topic = $queue->getTopic(AchievementTopic::class);
- if ($topic) {
- while ($topic->consume(function($message) use ($worker) {
- $event = AchievementEvent::createFromMessage($message);
- $worker->push(new HandleAchievementEventJob(['event' => $event]));
- return true;
- }));
- $this->idle($loopSleep);
- } else {
- $this->stderr("Не подключен топик модуля ачивок" . AchievementTopic::class);
- return ExitCode::UNSPECIFIED_ERROR;
- }
- } while($loop);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement