Skip to content

Commit 0bca3d5

Browse files
committed
tentativi sui lock
1 parent 8763d04 commit 0bca3d5

File tree

1 file changed

+44
-44
lines changed

1 file changed

+44
-44
lines changed

src/Console/ProcessCacheInvalidationEventsCommand.php

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -344,56 +344,56 @@ protected function processBatch(array $batchIdentifiers, array $eventsToUpdate):
344344
$attempts = 0;
345345
$updatedOk = false;
346346

347-
while ($attempts < $maxAttempts && !$updatedOk) {
348-
// Begin transaction for the batch
349-
DB::beginTransaction();
347+
// Separate keys and tags
348+
$keys = [];
349+
$tags = [];
350+
351+
foreach ($batchIdentifiers as $item) {
352+
switch ($item['type']) {
353+
case 'key':
354+
$keys[] = $item['identifier'] . '§' . $item['connection_name'];
355+
break;
356+
case 'tag':
357+
$tags[] = $item['identifier'] . '§' . $item['connection_name'];
358+
break;
359+
}
350360

351-
try {
352-
// Separate keys and tags
353-
$keys = [];
354-
$tags = [];
355-
356-
foreach ($batchIdentifiers as $item) {
357-
switch ($item['type']) {
358-
case 'key':
359-
$keys[] = $item['identifier'] . '§' . $item['connection_name'];
360-
break;
361-
case 'tag':
362-
$tags[] = $item['identifier'] . '§' . $item['connection_name'];
363-
break;
364-
}
365-
366-
if (empty($item['associated'])) {
367-
continue;
368-
}
369-
370-
// Include associated identifiers
371-
foreach ($item['associated'] as $assoc) {
372-
switch ($assoc['type']) {
373-
case 'key':
374-
$keys[] = $assoc['identifier'] . '§' . $assoc['connection_name'];
375-
break;
376-
case 'tag':
377-
$tags[] = $assoc['identifier'] . '§' . $assoc['connection_name'];
378-
break;
379-
}
380-
}
361+
if (empty($item['associated'])) {
362+
continue;
363+
}
364+
365+
// Include associated identifiers
366+
foreach ($item['associated'] as $assoc) {
367+
switch ($assoc['type']) {
368+
case 'key':
369+
$keys[] = $assoc['identifier'] . '§' . $assoc['connection_name'];
370+
break;
371+
case 'tag':
372+
$tags[] = $assoc['identifier'] . '§' . $assoc['connection_name'];
373+
break;
381374
}
375+
}
376+
}
382377

383-
// Remove duplicates
384-
$keys = array_unique($keys);
385-
$tags = array_unique($tags);
378+
// Remove duplicates
379+
$keys = array_unique($keys);
380+
$tags = array_unique($tags);
386381

387-
// Invalidate cache for keys
388-
if (!empty($keys)) {
389-
$this->invalidateKeys($keys);
390-
}
382+
// Invalidate cache for keys
383+
if (!empty($keys)) {
384+
$this->invalidateKeys($keys);
385+
}
391386

392-
// Invalidate cache for tags
393-
if (!empty($tags)) {
394-
$this->invalidateTags($tags);
395-
}
387+
// Invalidate cache for tags
388+
if (!empty($tags)) {
389+
$this->invalidateTags($tags);
390+
}
396391

392+
while ($attempts < $maxAttempts && !$updatedOk) {
393+
// Begin transaction for the batch
394+
DB::beginTransaction();
395+
396+
try {
397397
// Mark events as processed
398398
DB::table('cache_invalidation_events')
399399
->whereIn('id', $eventsToUpdate)

0 commit comments

Comments
 (0)