Update StoryIndexService, improve markSeen handling

pull/6134/head
Daniel Supernault 3 months ago
parent 9f8d46b68c
commit 3296a7a583
No known key found for this signature in database
GPG Key ID: 23740873EE6F76A1

@ -107,8 +107,14 @@ class StoryIndexService
Redis::sadd($key, (string) $storyId);
$expiresAt = CarbonImmutable::instance($storyCreatedAt)->addSeconds(self::STORY_TTL);
$ttl = max(1, $expiresAt->diffInSeconds(now(), false) * -1);
Redis::expire($key, max($ttl, (int) Redis::ttl($key)));
$ttl = max(1, $expiresAt->diffInSeconds(now()));
$currentTtl = Redis::ttl($key);
$currentTtl = ($currentTtl < 0) ? 0 : $currentTtl;
$finalTtl = max($ttl, $currentTtl);
Redis::expire($key, $finalTtl);
}
public function rebuildIndex(): array

Loading…
Cancel
Save