diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2022-02-22 15:31:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-22 15:31:56 +0100 |
commit | 9e80f6f18a2247d60438cac64fe52156a79ff93d (patch) | |
tree | 7930619834f0826d384121ecb99ef4af85a4b292 /apps/dav/lib/BackgroundJob/CleanupDirectLinksJob.php | |
parent | b5c6ae6d4f3ad5a3b0d86a7580fb860d8bfb384c (diff) | |
parent | c01eb0775648bd54e9cd4904499a30f448554968 (diff) | |
download | nextcloud-server-9e80f6f18a2247d60438cac64fe52156a79ff93d.tar.gz nextcloud-server-9e80f6f18a2247d60438cac64fe52156a79ff93d.zip |
Merge pull request #31316 from nextcloud/enhancement/sensitive-insensitive-dav-background-jobs
Mark DAV background jobs as time sensitive/insensitive
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); } } |