diff options
Diffstat (limited to 'apps/dav/lib/BackgroundJob/CleanupDirectLinksJob.php')
-rw-r--r-- | apps/dav/lib/BackgroundJob/CleanupDirectLinksJob.php | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/apps/dav/lib/BackgroundJob/CleanupDirectLinksJob.php b/apps/dav/lib/BackgroundJob/CleanupDirectLinksJob.php index 6c10a05f9a5..073fc53e07a 100644 --- a/apps/dav/lib/BackgroundJob/CleanupDirectLinksJob.php +++ b/apps/dav/lib/BackgroundJob/CleanupDirectLinksJob.php @@ -26,26 +26,25 @@ declare(strict_types=1); */ namespace OCA\DAV\BackgroundJob; -use OC\BackgroundJob\TimedJob; use OCA\DAV\Db\DirectMapper; use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\TimedJob; class CleanupDirectLinksJob extends TimedJob { - /** @var ITimeFactory */ - private $timeFactory; - /** @var DirectMapper */ private $mapper; public function __construct(ITimeFactory $timeFactory, DirectMapper $mapper) { - $this->setInterval(60 * 60 * 24); - - $this->timeFactory = $timeFactory; + parent::__construct($timeFactory); $this->mapper = $mapper; + + // Run once a day at off-peak time + $this->setInterval(24 * 60 * 60); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); } protected function run($argument) { // Delete all shares expired 24 hours ago - $this->mapper->deleteExpired($this->timeFactory->getTime() - 60 * 60 * 24); + $this->mapper->deleteExpired($this->time->getTime() - 60 * 60 * 24); } } |