setTimeSensitivity(self::TIME_INSENSITIVE); $this->setInterval(24 * 60 * 60); } protected function run(mixed $argument): void { $offset = $this->appConfig->getValueInt('core', 'files_gc_offset'); $users = $this->userManager->getSeenUsers($offset); $start = time(); $count = 0; foreach ($users as $user) { $cache = new File(); try { $cache->gc($user); } catch (\Exception $e) { $this->logger->warning('Exception when running cache gc.', [ 'app' => 'core', 'exception' => $e, ]); } $count++; $now = time(); // almost time for the next job run, stop early and save our location if ($now - $start > 23 * 60 * 60) { $this->appConfig->setValueInt('core', 'files_gc_offset', $offset + $count); return; } } $this->appConfig->setValueInt('core', 'files_gc_offset', 0); } }