diff options
author | provokateurin <kate@provokateurin.de> | 2024-10-07 17:36:55 +0200 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2024-11-25 08:42:06 +0100 |
commit | 10f1d9768940aeab91b278919a0c814ac9d55aef (patch) | |
tree | a108f2596b06b6aad4c26ba7277bce9c9ba94576 | |
parent | 9388c96a31644f1347c682bc2e3e06a63fa202c2 (diff) | |
download | nextcloud-server-10f1d9768940aeab91b278919a0c814ac9d55aef.tar.gz nextcloud-server-10f1d9768940aeab91b278919a0c814ac9d55aef.zip |
fix(BackgroundJobs): Adjust intervals and time sensitivitiesbackport/48600/stable28
Signed-off-by: provokateurin <kate@provokateurin.de>
24 files changed, 32 insertions, 47 deletions
diff --git a/apps/contactsinteraction/lib/BackgroundJob/CleanupJob.php b/apps/contactsinteraction/lib/BackgroundJob/CleanupJob.php index 0291f8ae6bc..37e22bb2ccd 100644 --- a/apps/contactsinteraction/lib/BackgroundJob/CleanupJob.php +++ b/apps/contactsinteraction/lib/BackgroundJob/CleanupJob.php @@ -27,7 +27,6 @@ namespace OCA\ContactsInteraction\BackgroundJob; use OCA\ContactsInteraction\Db\RecentContactMapper; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\TimedJob; class CleanupJob extends TimedJob { @@ -39,7 +38,7 @@ class CleanupJob extends TimedJob { parent::__construct($time); $this->setInterval(24 * 60 * 60); - $this->setTimeSensitivity(IJob::TIME_INSENSITIVE); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); } diff --git a/apps/dav/lib/BackgroundJob/UploadCleanup.php b/apps/dav/lib/BackgroundJob/UploadCleanup.php index c35aff4d15a..b4c948bbe7d 100644 --- a/apps/dav/lib/BackgroundJob/UploadCleanup.php +++ b/apps/dav/lib/BackgroundJob/UploadCleanup.php @@ -29,7 +29,6 @@ namespace OCA\DAV\BackgroundJob; use OC\User\NoUserException; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\IJobList; use OCP\BackgroundJob\TimedJob; use OCP\Files\File; @@ -51,7 +50,7 @@ class UploadCleanup extends TimedJob { // Run once a day $this->setInterval(60 * 60 * 24); - $this->setTimeSensitivity(IJob::TIME_INSENSITIVE); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); } protected function run($argument) { diff --git a/apps/federation/lib/SyncJob.php b/apps/federation/lib/SyncJob.php index d084b73c021..15269b63acb 100644 --- a/apps/federation/lib/SyncJob.php +++ b/apps/federation/lib/SyncJob.php @@ -37,6 +37,7 @@ class SyncJob extends TimedJob { parent::__construct($timeFactory); // Run once a day $this->setInterval(24 * 60 * 60); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); $this->syncService = $syncService; $this->logger = $logger; } diff --git a/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php b/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php index 2f700b8773e..07905c96b14 100644 --- a/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php +++ b/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php @@ -31,14 +31,12 @@ use OCP\BackgroundJob\TimedJob; use OCP\DirectEditing\IManager; class CleanupDirectEditingTokens extends TimedJob { - private const INTERVAL_MINUTES = 15 * 60; - private IManager $manager; public function __construct(ITimeFactory $time, IManager $manager) { parent::__construct($time); - $this->interval = self::INTERVAL_MINUTES; + $this->setInterval(15 * 60); $this->manager = $manager; } diff --git a/apps/files/lib/BackgroundJob/CleanupFileLocks.php b/apps/files/lib/BackgroundJob/CleanupFileLocks.php index 7ff28a50155..7281c51660d 100644 --- a/apps/files/lib/BackgroundJob/CleanupFileLocks.php +++ b/apps/files/lib/BackgroundJob/CleanupFileLocks.php @@ -32,19 +32,11 @@ use OCP\BackgroundJob\TimedJob; */ class CleanupFileLocks extends TimedJob { /** - * Default interval in minutes - * - * @var int $defaultIntervalMin - **/ - protected $defaultIntervalMin = 5; - - /** * sets the correct interval for this timed job */ public function __construct(ITimeFactory $time) { parent::__construct($time); - - $this->interval = $this->defaultIntervalMin * 60; + $this->setInterval(5 * 60); } /** diff --git a/apps/files/lib/BackgroundJob/DeleteExpiredOpenLocalEditor.php b/apps/files/lib/BackgroundJob/DeleteExpiredOpenLocalEditor.php index 9839bcde5b7..df8a22cdc9c 100644 --- a/apps/files/lib/BackgroundJob/DeleteExpiredOpenLocalEditor.php +++ b/apps/files/lib/BackgroundJob/DeleteExpiredOpenLocalEditor.php @@ -28,7 +28,6 @@ namespace OCA\Files\BackgroundJob; use OCA\Files\Db\OpenLocalEditorMapper; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\TimedJob; /** @@ -46,7 +45,7 @@ class DeleteExpiredOpenLocalEditor extends TimedJob { // Run every 12h $this->interval = 12 * 3600; - $this->setTimeSensitivity(IJob::TIME_INSENSITIVE); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); } /** diff --git a/apps/files/lib/BackgroundJob/DeleteOrphanedItems.php b/apps/files/lib/BackgroundJob/DeleteOrphanedItems.php index 6163955ddfd..f5fa9ba2b50 100644 --- a/apps/files/lib/BackgroundJob/DeleteOrphanedItems.php +++ b/apps/files/lib/BackgroundJob/DeleteOrphanedItems.php @@ -35,7 +35,6 @@ use Psr\Log\LoggerInterface; */ class DeleteOrphanedItems extends TimedJob { public const CHUNK_SIZE = 200; - protected $defaultIntervalMin = 60; /** * sets the correct interval for this timed job @@ -46,7 +45,7 @@ class DeleteOrphanedItems extends TimedJob { protected LoggerInterface $logger, ) { parent::__construct($time); - $this->interval = $this->defaultIntervalMin * 60; + $this->setInterval(60 * 60); } /** diff --git a/apps/files_external/lib/BackgroundJob/CredentialsCleanup.php b/apps/files_external/lib/BackgroundJob/CredentialsCleanup.php index 1b5e7779df4..1dc02421060 100644 --- a/apps/files_external/lib/BackgroundJob/CredentialsCleanup.php +++ b/apps/files_external/lib/BackgroundJob/CredentialsCleanup.php @@ -29,7 +29,6 @@ use OCA\Files_External\Lib\Auth\Password\LoginCredentials; use OCA\Files_External\Lib\StorageConfig; use OCA\Files_External\Service\UserGlobalStoragesService; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\TimedJob; use OCP\IUser; use OCP\IUserManager; @@ -54,7 +53,7 @@ class CredentialsCleanup extends TimedJob { // run every day $this->setInterval(24 * 60 * 60); - $this->setTimeSensitivity(IJob::TIME_INSENSITIVE); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); } protected function run($argument) { diff --git a/apps/files_reminders/lib/BackgroundJob/CleanUpReminders.php b/apps/files_reminders/lib/BackgroundJob/CleanUpReminders.php index afa8c514a0a..18ce5c6f818 100644 --- a/apps/files_reminders/lib/BackgroundJob/CleanUpReminders.php +++ b/apps/files_reminders/lib/BackgroundJob/CleanUpReminders.php @@ -28,7 +28,6 @@ namespace OCA\FilesReminders\BackgroundJob; use OCA\FilesReminders\Service\ReminderService; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\TimedJob; class CleanUpReminders extends TimedJob { @@ -39,7 +38,7 @@ class CleanUpReminders extends TimedJob { parent::__construct($time); $this->setInterval(24 * 60 * 60); // 1 day - $this->setTimeSensitivity(IJob::TIME_INSENSITIVE); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); } /** diff --git a/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php b/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php index 75606960e4b..c6f43703be9 100644 --- a/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php +++ b/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php @@ -45,7 +45,8 @@ class FederatedSharesDiscoverJob extends TimedJob { private LoggerInterface $logger, ) { parent::__construct($time); - $this->setInterval(86400); + $this->setInterval(24 * 60 * 60); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); } public function run($argument) { diff --git a/apps/files_sharing/lib/ExpireSharesJob.php b/apps/files_sharing/lib/ExpireSharesJob.php index f5eb5856aea..73f334d9de3 100644 --- a/apps/files_sharing/lib/ExpireSharesJob.php +++ b/apps/files_sharing/lib/ExpireSharesJob.php @@ -25,7 +25,6 @@ namespace OCA\Files_Sharing; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\TimedJob; use OCP\IDBConnection; use OCP\Share\Exceptions\ShareNotFound; @@ -51,7 +50,7 @@ class ExpireSharesJob extends TimedJob { // Run once a day $this->setInterval(24 * 60 * 60); - $this->setTimeSensitivity(IJob::TIME_INSENSITIVE); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); } diff --git a/apps/oauth2/lib/BackgroundJob/CleanupExpiredAuthorizationCode.php b/apps/oauth2/lib/BackgroundJob/CleanupExpiredAuthorizationCode.php index f4e08081ce6..8cb6b7cef7c 100644 --- a/apps/oauth2/lib/BackgroundJob/CleanupExpiredAuthorizationCode.php +++ b/apps/oauth2/lib/BackgroundJob/CleanupExpiredAuthorizationCode.php @@ -28,7 +28,6 @@ namespace OCA\OAuth2\BackgroundJob; use OCA\OAuth2\Db\AccessTokenMapper; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\TimedJob; use OCP\DB\Exception; use Psr\Log\LoggerInterface; @@ -44,7 +43,7 @@ class CleanupExpiredAuthorizationCode extends TimedJob { parent::__construct($timeFactory); // 30 days $this->setInterval(60 * 60 * 24 * 30); - $this->setTimeSensitivity(IJob::TIME_INSENSITIVE); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); } /** diff --git a/apps/twofactor_backupcodes/lib/BackgroundJob/RememberBackupCodesJob.php b/apps/twofactor_backupcodes/lib/BackgroundJob/RememberBackupCodesJob.php index 92898aecbba..e3f90a4a062 100644 --- a/apps/twofactor_backupcodes/lib/BackgroundJob/RememberBackupCodesJob.php +++ b/apps/twofactor_backupcodes/lib/BackgroundJob/RememberBackupCodesJob.php @@ -28,7 +28,6 @@ namespace OCA\TwoFactorBackupCodes\BackgroundJob; use OCP\AppFramework\Utility\ITimeFactory; use OCP\Authentication\TwoFactorAuth\IRegistry; -use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\IJobList; use OCP\BackgroundJob\TimedJob; use OCP\IUserManager; @@ -61,7 +60,7 @@ class RememberBackupCodesJob extends TimedJob { $this->jobList = $jobList; $this->setInterval(60 * 60 * 24 * 14); - $this->setTimeSensitivity(IJob::TIME_INSENSITIVE); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); } protected function run($argument) { diff --git a/apps/updatenotification/lib/Notification/BackgroundJob.php b/apps/updatenotification/lib/Notification/BackgroundJob.php index 285903d398b..367c6601a2d 100644 --- a/apps/updatenotification/lib/Notification/BackgroundJob.php +++ b/apps/updatenotification/lib/Notification/BackgroundJob.php @@ -54,6 +54,7 @@ class BackgroundJob extends TimedJob { parent::__construct($timeFactory); // Run once a day $this->setInterval(60 * 60 * 24); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); } protected function run($argument) { diff --git a/apps/user_ldap/lib/Jobs/CleanUp.php b/apps/user_ldap/lib/Jobs/CleanUp.php index f4e23446352..ab57338464d 100644 --- a/apps/user_ldap/lib/Jobs/CleanUp.php +++ b/apps/user_ldap/lib/Jobs/CleanUp.php @@ -45,7 +45,7 @@ class CleanUp extends TimedJob { protected $limit; /** @var int $defaultIntervalMin default interval in minutes */ - protected $defaultIntervalMin = 51; + protected $defaultIntervalMin = 60; /** @var User_LDAP|User_Proxy $userBackend */ protected $userBackend; diff --git a/apps/user_status/lib/BackgroundJob/ClearOldStatusesBackgroundJob.php b/apps/user_status/lib/BackgroundJob/ClearOldStatusesBackgroundJob.php index 7118f748f37..d5755f56b85 100644 --- a/apps/user_status/lib/BackgroundJob/ClearOldStatusesBackgroundJob.php +++ b/apps/user_status/lib/BackgroundJob/ClearOldStatusesBackgroundJob.php @@ -52,7 +52,7 @@ class ClearOldStatusesBackgroundJob extends TimedJob { $this->mapper = $mapper; // Run every time the cron is run - $this->setInterval(60); + $this->setInterval(0); } /** diff --git a/core/BackgroundJobs/CleanupLoginFlowV2.php b/core/BackgroundJobs/CleanupLoginFlowV2.php index 7a17672f99e..27c592b0092 100644 --- a/core/BackgroundJobs/CleanupLoginFlowV2.php +++ b/core/BackgroundJobs/CleanupLoginFlowV2.php @@ -37,7 +37,7 @@ class CleanupLoginFlowV2 extends TimedJob { ) { parent::__construct($time); - $this->setInterval(3600); + $this->setInterval(60 * 60); } protected function run($argument): void { diff --git a/core/BackgroundJobs/GenerateMetadataJob.php b/core/BackgroundJobs/GenerateMetadataJob.php index bcdaf23051c..3d01a150ae5 100644 --- a/core/BackgroundJobs/GenerateMetadataJob.php +++ b/core/BackgroundJobs/GenerateMetadataJob.php @@ -48,8 +48,8 @@ class GenerateMetadataJob extends TimedJob { ) { parent::__construct($time); - $this->setTimeSensitivity(\OCP\BackgroundJob\IJob::TIME_INSENSITIVE); - $this->setInterval(24 * 3600); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); + $this->setInterval(24 * 60 * 60); } protected function run(mixed $argument): void { diff --git a/lib/private/Preview/BackgroundCleanupJob.php b/lib/private/Preview/BackgroundCleanupJob.php index 4376cc06eca..a2e91cc2633 100644 --- a/lib/private/Preview/BackgroundCleanupJob.php +++ b/lib/private/Preview/BackgroundCleanupJob.php @@ -54,7 +54,8 @@ class BackgroundCleanupJob extends TimedJob { bool $isCLI) { parent::__construct($timeFactory); // Run at most once an hour - $this->setInterval(3600); + $this->setInterval(60 * 60); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); $this->connection = $connection; $this->previewFolder = $previewFolder; diff --git a/lib/private/Security/Bruteforce/CleanupJob.php b/lib/private/Security/Bruteforce/CleanupJob.php index 13628dd300d..ae7cb09217c 100644 --- a/lib/private/Security/Bruteforce/CleanupJob.php +++ b/lib/private/Security/Bruteforce/CleanupJob.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OC\Security\Bruteforce; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\TimedJob; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; @@ -39,8 +38,8 @@ class CleanupJob extends TimedJob { parent::__construct($time); // Run once a day - $this->setInterval(3600 * 24); - $this->setTimeSensitivity(IJob::TIME_INSENSITIVE); + $this->setInterval(60 * 60 * 24); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); } protected function run($argument): void { diff --git a/lib/private/TextProcessing/RemoveOldTasksBackgroundJob.php b/lib/private/TextProcessing/RemoveOldTasksBackgroundJob.php index 89d329acfbb..a5aeb3d5ad0 100644 --- a/lib/private/TextProcessing/RemoveOldTasksBackgroundJob.php +++ b/lib/private/TextProcessing/RemoveOldTasksBackgroundJob.php @@ -33,7 +33,7 @@ use OCP\DB\Exception; use Psr\Log\LoggerInterface; class RemoveOldTasksBackgroundJob extends TimedJob { - public const MAX_TASK_AGE_SECONDS = 60 * 50 * 24 * 7; // 1 week + public const MAX_TASK_AGE_SECONDS = 60 * 60 * 24 * 7; // 1 week public function __construct( ITimeFactory $timeFactory, @@ -43,6 +43,7 @@ class RemoveOldTasksBackgroundJob extends TimedJob { ) { parent::__construct($timeFactory); $this->setInterval(60 * 60 * 24); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); } /** diff --git a/lib/private/TextToImage/RemoveOldTasksBackgroundJob.php b/lib/private/TextToImage/RemoveOldTasksBackgroundJob.php index 2ecebc241bf..499f186a56d 100644 --- a/lib/private/TextToImage/RemoveOldTasksBackgroundJob.php +++ b/lib/private/TextToImage/RemoveOldTasksBackgroundJob.php @@ -37,7 +37,7 @@ use OCP\Files\NotPermittedException; use Psr\Log\LoggerInterface; class RemoveOldTasksBackgroundJob extends TimedJob { - public const MAX_TASK_AGE_SECONDS = 60 * 50 * 24 * 7; // 1 week + public const MAX_TASK_AGE_SECONDS = 60 * 60 * 24 * 7; // 1 week private IAppData $appData; @@ -50,6 +50,7 @@ class RemoveOldTasksBackgroundJob extends TimedJob { parent::__construct($timeFactory); $this->appData = $appDataFactory->get('core'); $this->setInterval(60 * 60 * 24); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); } /** diff --git a/lib/private/User/BackgroundJobs/CleanupDeletedUsers.php b/lib/private/User/BackgroundJobs/CleanupDeletedUsers.php index 3c1b73637ac..f999031a2a9 100644 --- a/lib/private/User/BackgroundJobs/CleanupDeletedUsers.php +++ b/lib/private/User/BackgroundJobs/CleanupDeletedUsers.php @@ -12,7 +12,6 @@ use OC\User\Manager; use OC\User\PartiallyDeletedUsersBackend; use OC\User\User; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\TimedJob; use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; @@ -26,8 +25,8 @@ class CleanupDeletedUsers extends TimedJob { private LoggerInterface $logger, ) { parent::__construct($time); - $this->setTimeSensitivity(IJob::TIME_INSENSITIVE); - $this->setInterval(24 * 3600); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); + $this->setInterval(24 * 60 * 60); } protected function run($argument): void { diff --git a/lib/public/BackgroundJob/TimedJob.php b/lib/public/BackgroundJob/TimedJob.php index 3c8931a265e..d843663f1fe 100644 --- a/lib/public/BackgroundJob/TimedJob.php +++ b/lib/public/BackgroundJob/TimedJob.php @@ -73,8 +73,8 @@ abstract class TimedJob extends Job { * @since 24.0.0 */ public function setTimeSensitivity(int $sensitivity): void { - if ($sensitivity !== IJob::TIME_SENSITIVE && - $sensitivity !== IJob::TIME_INSENSITIVE) { + if ($sensitivity !== self::TIME_SENSITIVE && + $sensitivity !== self::TIME_INSENSITIVE) { throw new \InvalidArgumentException('Invalid sensitivity'); } |