Skip to content

Commit 4260dd1

Browse files
authored
Merge pull request #49463 from nextcloud/backport/48600/stable28
[stable28] fix(BackgroundJobs): Adjust intervals and time sensitivities
2 parents a7d6c41 + 10f1d97 commit 4260dd1

File tree

24 files changed

+37
-47
lines changed

24 files changed

+37
-47
lines changed

apps/contactsinteraction/lib/BackgroundJob/CleanupJob.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
use OCA\ContactsInteraction\Db\RecentContactMapper;
2929
use OCP\AppFramework\Utility\ITimeFactory;
30-
use OCP\BackgroundJob\IJob;
3130
use OCP\BackgroundJob\TimedJob;
3231

3332
class CleanupJob extends TimedJob {
@@ -39,7 +38,7 @@ public function __construct(
3938
parent::__construct($time);
4039

4140
$this->setInterval(24 * 60 * 60);
42-
$this->setTimeSensitivity(IJob::TIME_INSENSITIVE);
41+
$this->setTimeSensitivity(self::TIME_INSENSITIVE);
4342

4443
}
4544

apps/dav/lib/BackgroundJob/UploadCleanup.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
use OC\User\NoUserException;
3131
use OCP\AppFramework\Utility\ITimeFactory;
32-
use OCP\BackgroundJob\IJob;
3332
use OCP\BackgroundJob\IJobList;
3433
use OCP\BackgroundJob\TimedJob;
3534
use OCP\Files\File;
@@ -51,7 +50,7 @@ public function __construct(ITimeFactory $time, IRootFolder $rootFolder, IJobLis
5150

5251
// Run once a day
5352
$this->setInterval(60 * 60 * 24);
54-
$this->setTimeSensitivity(IJob::TIME_INSENSITIVE);
53+
$this->setTimeSensitivity(self::TIME_INSENSITIVE);
5554
}
5655

5756
protected function run($argument) {

apps/federation/lib/SyncJob.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public function __construct(SyncFederationAddressBooks $syncService, LoggerInter
3737
parent::__construct($timeFactory);
3838
// Run once a day
3939
$this->setInterval(24 * 60 * 60);
40+
$this->setTimeSensitivity(self::TIME_INSENSITIVE);
4041
$this->syncService = $syncService;
4142
$this->logger = $logger;
4243
}

apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,12 @@
3131
use OCP\DirectEditing\IManager;
3232

3333
class CleanupDirectEditingTokens extends TimedJob {
34-
private const INTERVAL_MINUTES = 15 * 60;
35-
3634
private IManager $manager;
3735

3836
public function __construct(ITimeFactory $time,
3937
IManager $manager) {
4038
parent::__construct($time);
41-
$this->interval = self::INTERVAL_MINUTES;
39+
$this->setInterval(15 * 60);
4240
$this->manager = $manager;
4341
}
4442

apps/files/lib/BackgroundJob/CleanupFileLocks.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,12 @@
3131
* Clean up all file locks that are expired for the DB file locking provider
3232
*/
3333
class CleanupFileLocks extends TimedJob {
34-
/**
35-
* Default interval in minutes
36-
*
37-
* @var int $defaultIntervalMin
38-
**/
39-
protected $defaultIntervalMin = 5;
40-
4134
/**
4235
* sets the correct interval for this timed job
4336
*/
4437
public function __construct(ITimeFactory $time) {
4538
parent::__construct($time);
46-
47-
$this->interval = $this->defaultIntervalMin * 60;
39+
$this->setInterval(5 * 60);
4840
}
4941

5042
/**

apps/files/lib/BackgroundJob/DeleteExpiredOpenLocalEditor.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929
use OCA\Files\Db\OpenLocalEditorMapper;
3030
use OCP\AppFramework\Utility\ITimeFactory;
31-
use OCP\BackgroundJob\IJob;
3231
use OCP\BackgroundJob\TimedJob;
3332

3433
/**
@@ -46,7 +45,7 @@ public function __construct(
4645

4746
// Run every 12h
4847
$this->interval = 12 * 3600;
49-
$this->setTimeSensitivity(IJob::TIME_INSENSITIVE);
48+
$this->setTimeSensitivity(self::TIME_INSENSITIVE);
5049
}
5150

5251
/**

apps/files/lib/BackgroundJob/DeleteOrphanedItems.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
*/
3636
class DeleteOrphanedItems extends TimedJob {
3737
public const CHUNK_SIZE = 200;
38-
protected $defaultIntervalMin = 60;
3938

4039
/**
4140
* sets the correct interval for this timed job
@@ -46,7 +45,7 @@ public function __construct(
4645
protected LoggerInterface $logger,
4746
) {
4847
parent::__construct($time);
49-
$this->interval = $this->defaultIntervalMin * 60;
48+
$this->setInterval(60 * 60);
5049
}
5150

5251
/**

apps/files_external/lib/BackgroundJob/CredentialsCleanup.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
use OCA\Files_External\Lib\StorageConfig;
3030
use OCA\Files_External\Service\UserGlobalStoragesService;
3131
use OCP\AppFramework\Utility\ITimeFactory;
32-
use OCP\BackgroundJob\IJob;
3332
use OCP\BackgroundJob\TimedJob;
3433
use OCP\IUser;
3534
use OCP\IUserManager;
@@ -54,7 +53,7 @@ public function __construct(
5453

5554
// run every day
5655
$this->setInterval(24 * 60 * 60);
57-
$this->setTimeSensitivity(IJob::TIME_INSENSITIVE);
56+
$this->setTimeSensitivity(self::TIME_INSENSITIVE);
5857
}
5958

6059
protected function run($argument) {

apps/files_reminders/lib/BackgroundJob/CleanUpReminders.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929
use OCA\FilesReminders\Service\ReminderService;
3030
use OCP\AppFramework\Utility\ITimeFactory;
31-
use OCP\BackgroundJob\IJob;
3231
use OCP\BackgroundJob\TimedJob;
3332

3433
class CleanUpReminders extends TimedJob {
@@ -39,7 +38,7 @@ public function __construct(
3938
parent::__construct($time);
4039

4140
$this->setInterval(24 * 60 * 60); // 1 day
42-
$this->setTimeSensitivity(IJob::TIME_INSENSITIVE);
41+
$this->setTimeSensitivity(self::TIME_INSENSITIVE);
4342
}
4443

4544
/**

apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public function __construct(
4545
private LoggerInterface $logger,
4646
) {
4747
parent::__construct($time);
48-
$this->setInterval(86400);
48+
$this->setInterval(24 * 60 * 60);
49+
$this->setTimeSensitivity(self::TIME_INSENSITIVE);
4950
}
5051

5152
public function run($argument) {

0 commit comments

Comments
 (0)