summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Wurst <ChristophWurst@users.noreply.github.com>2022-02-22 09:49:59 +0100
committerGitHub <noreply@github.com>2022-02-22 09:49:59 +0100
commitdfbb7597976c76c5279024cf742416bdc1d3fef2 (patch)
tree475d6d15d068e1f8414be05bd8af760cb1311c03
parentc43ab4a2ca35fdbdfbe8d7cf1a4b21f0fbf2efa8 (diff)
parentd0fff89928a8d5f7f0e7c69809dba6fcc19f8f52 (diff)
Merge pull request #2645 from nextcloud/enhancement/sensitive-insensitive-background-jobs
Mark background jobs as time sensitive/insensitive
-rw-r--r--lib/Cron/SocialUpdateRegistration.php21
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);
+ }
}
/**