Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dbe0cf7

Browse filesBrowse files
committed
Fix Redis replication on Redis <5
1 parent 66e8ae9 commit dbe0cf7
Copy full SHA for dbe0cf7

File tree

1 file changed

+15
-1
lines changed
Filter options

1 file changed

+15
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Cache/Adapter/RedisTagAwareAdapter.php
+15-1Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ protected function doDeleteYieldTags(array $ids): iterable
159159
});
160160

161161
foreach ($results as $id => $result) {
162+
if ($result instanceof \RedisException) {
163+
throw $result;
164+
}
165+
162166
try {
163167
yield $id => !\is_string($result) || '' === $result ? [] : $this->marshaller->unmarshall($result);
164168
} catch (\Exception $e) {
@@ -197,6 +201,8 @@ protected function doInvalidate(array $tagIds): bool
197201
// gargage collect that set from the client side.
198202

199203
$lua = <<<'EOLUA'
204+
redis.replicate_commands()
205+
200206
local cursor = '0'
201207
local id = KEYS[1]
202208
repeat
@@ -234,14 +240,22 @@ protected function doInvalidate(array $tagIds): bool
234240
});
235241

236242
$lua = <<<'EOLUA'
243+
redis.replicate_commands()
244+
237245
local id = KEYS[1]
238246
local cursor = table.remove(ARGV)
239247
redis.call('SREM', '{'..id..'}'..id, unpack(ARGV))
240248
241249
return redis.call('SSCAN', '{'..id..'}'..id, cursor, 'COUNT', 5000)
242250
EOLUA;
243251

244-
foreach ($results as $id => [$cursor, $ids]) {
252+
foreach ($results as $id => $values) {
253+
if ($values instanceof \RedisException) {
254+
throw $values;
255+
}
256+
257+
[$cursor, $ids] = $values;
258+
245259
while ($ids || '0' !== $cursor) {
246260
$this->doDelete($ids);
247261

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.