diff options
author | provokateurin <kate@provokateurin.de> | 2024-10-07 17:36:55 +0200 |
---|---|---|
committer | provokateurin <kate@provokateurin.de> | 2024-10-08 11:26:53 +0200 |
commit | 54ec472d9a2c8a3d3c5daf0594bb887b11a81614 (patch) | |
tree | 98660989fcc8c32c938491e7da51ea3afbea5fa3 /lib/private | |
parent | d7aff6c1500fb85269945064d4c34085c4240425 (diff) | |
download | nextcloud-server-54ec472d9a2c8a3d3c5daf0594bb887b11a81614.tar.gz nextcloud-server-54ec472d9a2c8a3d3c5daf0594bb887b11a81614.zip |
fix(BackgroundJobs): Adjust intervals and time sensitivities
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'lib/private')
6 files changed, 12 insertions, 11 deletions
diff --git a/lib/private/Preview/BackgroundCleanupJob.php b/lib/private/Preview/BackgroundCleanupJob.php index 8449e73983c..ad5e793474b 100644 --- a/lib/private/Preview/BackgroundCleanupJob.php +++ b/lib/private/Preview/BackgroundCleanupJob.php @@ -37,7 +37,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 e7d981caa08..fdf7fb97d31 100644 --- a/lib/private/Security/Bruteforce/CleanupJob.php +++ b/lib/private/Security/Bruteforce/CleanupJob.php @@ -9,7 +9,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; @@ -22,8 +21,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/TaskProcessing/RemoveOldTasksBackgroundJob.php b/lib/private/TaskProcessing/RemoveOldTasksBackgroundJob.php index acec2f46c05..c6f26e3aa8b 100644 --- a/lib/private/TaskProcessing/RemoveOldTasksBackgroundJob.php +++ b/lib/private/TaskProcessing/RemoveOldTasksBackgroundJob.php @@ -16,7 +16,7 @@ use OCP\Files\SimpleFS\ISimpleFolder; use Psr\Log\LoggerInterface; class RemoveOldTasksBackgroundJob extends TimedJob { - public const MAX_TASK_AGE_SECONDS = 60 * 50 * 24 * 7 * 4; // 4 weeks + public const MAX_TASK_AGE_SECONDS = 60 * 60 * 24 * 7 * 4; // 4 weeks private \OCP\Files\IAppData $appData; public function __construct( @@ -28,7 +28,7 @@ class RemoveOldTasksBackgroundJob extends TimedJob { parent::__construct($timeFactory); $this->setInterval(60 * 60 * 24); // can be deferred to maintenance window - $this->setTimeSensitivity(TimedJob::TIME_INSENSITIVE); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); $this->appData = $appDataFactory->get('core'); } diff --git a/lib/private/TextProcessing/RemoveOldTasksBackgroundJob.php b/lib/private/TextProcessing/RemoveOldTasksBackgroundJob.php index 4a336d56077..be5e4127d08 100644 --- a/lib/private/TextProcessing/RemoveOldTasksBackgroundJob.php +++ b/lib/private/TextProcessing/RemoveOldTasksBackgroundJob.php @@ -17,7 +17,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, @@ -26,6 +26,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 7d9170090b7..225984a7956 100644 --- a/lib/private/TextToImage/RemoveOldTasksBackgroundJob.php +++ b/lib/private/TextToImage/RemoveOldTasksBackgroundJob.php @@ -21,7 +21,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; @@ -34,6 +34,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 { |