Skip to content

Commit

Permalink
Support cli queue runner too
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Stark committed Jan 18, 2022
1 parent 0f0e117 commit 5ccd5de
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes will be documented in this file.

- Fixed phpstan (1.4) level 6
- After install example.config.php is copied to config/relax.php
- Support cli queue runner too, including AsyncQueue

## 1.0.0 - 2022-01-18

Expand Down
12 changes: 10 additions & 2 deletions src/Handlers/QueueServiceHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,17 @@ public function __invoke(): void
return;
}

// Overwrite 'queue' key in service locator
// Initialize HashedJobQueue
$serializer = Craft::$app->getQueue()->serializer;
$hasher = new DefaultHasher($serializer);
Craft::$app->set('queue', new HashedJobQueue($hasher));
$queue = new HashedJobQueue($hasher);

// Overwrite 'queue' key in service locator
Craft::$app->set('queue', $queue);

// Overwrite 'queue' property of queue\Command
if (isset(Craft::$app->controllerMap['queue']['queue'])) {
Craft::$app->controllerMap['queue']['queue'] = $queue;
}
}
}

0 comments on commit 5ccd5de

Please sign in to comment.