Skip to content

Commit 82608b0

Browse files
committed
feat: support sync and any other unknown as queue adapter for reporting status
1 parent ebd0f84 commit 82608b0

1 file changed

Lines changed: 35 additions & 5 deletions

File tree

src/Components/Health/Checker/PerformanceChecker/QueueConnectionChecker.php

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,46 @@ public function __construct(
1818

1919
public function collect(HealthCollection $collection): void
2020
{
21-
if (\str_starts_with($this->connection, 'doctrine://default')) {
21+
$schema = $this->getSchema();
22+
23+
$id = 'queue.adapter';
24+
$url = 'https://developer.shopware.com/docs/guides/hosting/infrastructure/message-queue.html#message-queue-on-production-systems';
25+
26+
if ($schema === 'doctrine') {
27+
$collection->add(
28+
SettingsResult::warning(
29+
$id,
30+
'The queue storage in database does not scale well with multiple workers',
31+
$schema,
32+
'redis or rabbitmq',
33+
$url
34+
)
35+
);
36+
37+
return;
38+
}
39+
40+
if ($schema === 'sync') {
2241
$collection->add(
2342
SettingsResult::warning(
24-
'queue.adapter',
25-
'The default queue storage in database does not scale well with multiple workers',
26-
'default',
43+
$id,
44+
'The sync queue is not suitable for production environments',
45+
$schema,
2746
'redis or rabbitmq',
28-
'https://developer.shopware.com/docs/guides/hosting/infrastructure/message-queue#transport-rabbitmq-example'
47+
$url
2948
)
3049
);
3150
}
3251
}
52+
53+
private function getSchema(): string
54+
{
55+
$urlSchema = \parse_url($this->connection, \PHP_URL_SCHEME);
56+
57+
if (!is_string($urlSchema)) {
58+
$urlSchema = explode('://', $this->connection)[0] ?? 'unknown';
59+
}
60+
61+
return $urlSchema;
62+
}
3363
}

0 commit comments

Comments
 (0)