diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2022-02-18 17:45:17 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2022-02-18 17:45:17 +0100 |
commit | d0fff89928a8d5f7f0e7c69809dba6fcc19f8f52 (patch) | |
tree | 79af13b43237fcb746afde15700262bdb88d244b | |
parent | 10aa07552c2cfff91495e5356916003f62ff7d75 (diff) |
Mark background jobs as time sensitive/insensitive
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
-rw-r--r-- | lib/Cron/SocialUpdateRegistration.php | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/Cron/SocialUpdateRegistration.php b/lib/Cron/SocialUpdateRegistration.php index 1f4e1497..ddb2e4b7 100644 --- a/lib/Cron/SocialUpdateRegistration.php +++ b/lib/Cron/SocialUpdateRegistration.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * @copyright 2017 Georg Ehrke <oc.list@georgehrke.com> * @@ -29,11 +32,13 @@ use OCA\Contacts\AppInfo\Application; use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\IJobList; +use OCP\BackgroundJob\TimedJob; use OCP\IUser; use OCP\IConfig; use OCP\IUserManager; +use function method_exists; -class SocialUpdateRegistration extends \OC\BackgroundJob\TimedJob { +class SocialUpdateRegistration extends TimedJob { private $appName; /** @var IUserManager */ @@ -53,19 +58,25 @@ class SocialUpdateRegistration extends \OC\BackgroundJob\TimedJob { * @param IJobList $jobList */ public function __construct( - // ITimeFactory $time, + ITimeFactory $time, IUserManager $userManager, IConfig $config, IJobList $jobList) { - //parent::__construct($time); - + parent::__construct($time); + $this->appName = Application::APP_ID; $this->userManager = $userManager; $this->config = $config; $this->jobList = $jobList; // Run once a week - parent::setInterval(7 * 24 * 60 * 60); + $this->setInterval(7 * 24 * 60 * 60); + /** + * @todo remove check with 24+ + */ + if (method_exists($this, 'setTimeSensitivity')) { + $this->setTimeSensitivity(self::TIME_INSENSITIVE); + } } /** |