Optimize visit aggregation, prevent stale cache in limits, fix Redis exist check, edge mobile detection, and scheduling

This commit is contained in:
Bartłomiej Janczak
2026-06-03 14:10:14 +02:00
parent 0cdc4ad0db
commit c5147ac170
7 changed files with 56 additions and 23 deletions

View File

@@ -25,9 +25,13 @@ class SyncBufferedCountersCommand extends Command
if (Cache::getDefaultDriver() === 'redis' && class_exists(Redis::class)) {
$tempKey = "{$dirtyKey}:temp:".time();
try {
Redis::rename($dirtyKey, $tempKey);
$dirtyIds = Redis::smembers($tempKey);
Redis::del($tempKey);
if (Redis::exists($dirtyKey)) {
Redis::rename($dirtyKey, $tempKey);
$dirtyIds = Redis::smembers($tempKey);
Redis::del($tempKey);
} else {
$dirtyIds = [];
}
} catch (\Throwable) {
// If key does not exist or rename fails, fallback
$dirtyIds = [];