8000 Fix Redis replication on Redis <5 · symfony/symfony@64784d2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 64784d2

Browse files
committed
Fix Redis replication on Redis <5
1 parent b3e1322 commit 64784d2

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ protected function doDeleteYieldTags(array $ids): iterable
163163
});
164164

165165
foreach ($results as $id => $result) {
166+
if ($result instanceof \RedisException) {
167+
throw $result;
168+
}
169+
166170
try {
167171
yield $id => !\is_string($result) || '' === $result ? [] : $this->marshaller->unmarshall($result);
168172
} catch (\Exception $e) {
@@ -201,6 +205,8 @@ protected function doInvalidate(array $tagIds): bool
201205
// gargage collect that set from the client side.
202206

203207
$lua = <<<'EOLUA'
208+
redis.replicate_commands()
209+
204210
local cursor = '0'
205211
local id = KEYS[1]
206212
repeat
@@ -238,14 +244,23 @@ protected function doInvalidate(array $tagIds): bool
238244
});
239245

240246
$lua = <<<'EOLUA'
247+
redis.replicate_commands()
248+
241249
local id = KEYS[1]
242250
local cursor = table.remove(ARGV)
243251
redis.call('SREM', '{'..id..'}'..id, unpack(ARGV))
244252
245253
return redis.call('SSCAN', '{'..id..'}'..id, cursor, 'COUNT', 5000)
246254
EOLUA;
247255

248-
foreach ($results as $id => [$cursor, $ids]) {
256+
257+
foreach ($results as $id => $values) {
258+
if ($values instanceof \RedisException) {
259+
throw $values;
260+
}
261+
262+
[$cursor, $ids] = $values;
263+
249264
while ($ids || '0' !== $cursor) {
250265
$this->doDelete($ids);
251266

0 commit comments

Comments
 (0)
0