Skip to content

Commit 5779263

Browse files
committed
feature #61955 [Messenger] bump ext-redis to 6.2 and ext-relay to 0.12 minimum (xabbuh)
This PR was merged into the 7.4 branch. Discussion ---------- [Messenger] bump ext-redis to 6.2 and ext-relay to 0.12 minimum | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | | License | MIT Commits ------- 846422a bump ext-redis to 6.2 and ext-relay to 0.12 minimum
2 parents 40d3c4b + 846422a commit 5779263

File tree

4 files changed

+11
-47
lines changed

4 files changed

+11
-47
lines changed

src/Symfony/Component/Cache/Traits/Relay/WaitaofTrait.php

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/Symfony/Component/Messenger/Bridge/Redis/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
7.4
5+
---
6+
7+
* Bump ext-redis to 6.2 and ext-relay to 0.12 minimum
8+
49
7.3
510
---
611

src/Symfony/Component/Messenger/Bridge/Redis/Transport/Connection.php

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ class Connection
7171

7272
public function __construct(array $options, \Redis|Relay|\RedisCluster|null $redis = null)
7373
{
74-
if (version_compare(phpversion('redis'), '4.3.0', '<')) {
75-
throw new LogicException('The redis transport requires php-redis 4.3.0 or higher.');
76-
}
77-
7874
$options += self::DEFAULT_OPTIONS;
7975
$host = $options['host'];
8076
$port = $options['port'];
@@ -116,7 +112,7 @@ public function __construct(array $options, \Redis|Relay|\RedisCluster|null $red
116112
}
117113

118114
try {
119-
if (\extension_loaded('redis') && version_compare(phpversion('redis'), '6.0.0-dev', '>=')) {
115+
if (\extension_loaded('redis')) {
120116
$params = [
121117
'host' => $host,
122118
'port' => $port,
@@ -701,7 +697,6 @@ public function getMessageCount(): int
701697
}
702698

703699
// Iterate through the stream. See https://redis.io/commands/xrange/#iterating-a-stream.
704-
$useExclusiveRangeInterval = version_compare(phpversion('redis'), '6.2.0', '>=');
705700
$total = 0;
706701
while (true) {
707702
if (!$range = $redis->xRange($this->stream, $lastDeliveredId, '+', 100)) {
@@ -710,11 +705,7 @@ public function getMessageCount(): int
710705

711706
$total += \count($range);
712707

713-
if ($useExclusiveRangeInterval) {
714-
$lastDeliveredId = preg_replace_callback('#\d+$#', static fn (array $matches) => (int) $matches[0] + 1, array_key_last($range));
715-
} else {
716-
$lastDeliveredId = '('.array_key_last($range);
717-
}
708+
$lastDeliveredId = preg_replace_callback('#\d+$#', static fn (array $matches) => (int) $matches[0] + 1, array_key_last($range));
718709
}
719710
}
720711

src/Symfony/Component/Messenger/Bridge/Redis/composer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
"symfony/serializer": "^6.4|^7.0|^8.0",
2626
"symfony/var-dumper": "^6.4|^7.0|^8.0"
2727
},
28+
"conflict": {
29+
"ext-redis": "<6.2",
30+
"ext-relay": "<0.12"
31+
},
2832
"autoload": {
2933
"psr-4": { "Symfony\\Component\\Messenger\\Bridge\\Redis\\": "" },
3034
"exclude-from-classmap": [

0 commit comments

Comments
 (0)