Skip to content

Commit

Permalink
feat: support sync and any other unknown as queue adapter for reporti…
Browse files Browse the repository at this point in the history
…ng status
  • Loading branch information
tinect committed Feb 9, 2024
1 parent ebd0f84 commit 82608b0
Showing 1 changed file with 35 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,46 @@ public function __construct(

public function collect(HealthCollection $collection): void
{
if (\str_starts_with($this->connection, 'doctrine://default')) {
$schema = $this->getSchema();

$id = 'queue.adapter';
$url = 'https://developer.shopware.com/docs/guides/hosting/infrastructure/message-queue.html#message-queue-on-production-systems';

if ($schema === 'doctrine') {
$collection->add(
SettingsResult::warning(
$id,
'The queue storage in database does not scale well with multiple workers',
$schema,
'redis or rabbitmq',
$url
)
);

return;
}

if ($schema === 'sync') {
$collection->add(
SettingsResult::warning(
'queue.adapter',
'The default queue storage in database does not scale well with multiple workers',
'default',
$id,
'The sync queue is not suitable for production environments',
$schema,
'redis or rabbitmq',
'https://developer.shopware.com/docs/guides/hosting/infrastructure/message-queue#transport-rabbitmq-example'
$url
)
);
}
}

private function getSchema(): string
{
$urlSchema = \parse_url($this->connection, \PHP_URL_SCHEME);

if (!is_string($urlSchema)) {
$urlSchema = explode('://', $this->connection)[0] ?? 'unknown';
}

return $urlSchema;
}
}

0 comments on commit 82608b0

Please sign in to comment.