From 7aa45495dda84fcbbb8e81115633ad8ed7a82e94 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Mon, 7 Oct 2024 17:36:55 +0200 Subject: [PATCH] fix(BackgroundJobs): Adjust intervals and time sensitivities Signed-off-by: provokateurin --- .../lib/BackgroundJob/CleanupJob.php | 3 +-- apps/dav/lib/BackgroundJob/UploadCleanup.php | 3 +-- apps/federation/lib/SyncJob.php | 1 + .../lib/BackgroundJob/CleanupDirectEditingTokens.php | 4 +--- apps/files/lib/BackgroundJob/CleanupFileLocks.php | 10 +--------- .../lib/BackgroundJob/DeleteExpiredOpenLocalEditor.php | 3 +-- apps/files/lib/BackgroundJob/DeleteOrphanedItems.php | 3 +-- .../lib/BackgroundJob/CredentialsCleanup.php | 3 +-- .../lib/BackgroundJob/CleanUpReminders.php | 3 +-- .../lib/BackgroundJob/FederatedSharesDiscoverJob.php | 3 ++- apps/files_sharing/lib/ExpireSharesJob.php | 3 +-- apps/files_sharing/lib/SharesReminderJob.php | 4 ++-- .../BackgroundJob/CleanupExpiredAuthorizationCode.php | 3 +-- .../lib/BackgroundJob/RememberBackupCodesJob.php | 3 +-- .../lib/BackgroundJob/UpdateAvailableNotifications.php | 1 + apps/user_ldap/lib/Jobs/CleanUp.php | 2 +- .../BackgroundJob/ClearOldStatusesBackgroundJob.php | 2 +- core/BackgroundJobs/CleanupLoginFlowV2.php | 3 ++- core/BackgroundJobs/GenerateMetadataJob.php | 4 ++-- lib/private/Preview/BackgroundCleanupJob.php | 4 ++-- lib/private/Security/Bruteforce/CleanupJob.php | 5 ++--- .../TaskProcessing/RemoveOldTasksBackgroundJob.php | 4 ++-- .../TextProcessing/RemoveOldTasksBackgroundJob.php | 3 ++- .../TextToImage/RemoveOldTasksBackgroundJob.php | 3 ++- .../User/BackgroundJobs/CleanupDeletedUsers.php | 5 ++--- lib/public/BackgroundJob/TimedJob.php | 4 ++-- 26 files changed, 37 insertions(+), 52 deletions(-) diff --git a/apps/contactsinteraction/lib/BackgroundJob/CleanupJob.php b/apps/contactsinteraction/lib/BackgroundJob/CleanupJob.php index 38fd0e155313c..b89a2c1fbb3cf 100644 --- a/apps/contactsinteraction/lib/BackgroundJob/CleanupJob.php +++ b/apps/contactsinteraction/lib/BackgroundJob/CleanupJob.php @@ -10,7 +10,6 @@ use OCA\ContactsInteraction\Db\RecentContactMapper; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\TimedJob; class CleanupJob extends TimedJob { @@ -22,7 +21,7 @@ public function __construct( 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 6d5eca6920c48..aa19dbb22ece8 100644 --- a/apps/dav/lib/BackgroundJob/UploadCleanup.php +++ b/apps/dav/lib/BackgroundJob/UploadCleanup.php @@ -10,7 +10,6 @@ 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; @@ -32,7 +31,7 @@ public function __construct(ITimeFactory $time, IRootFolder $rootFolder, IJobLis // 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 3ec9453c8056a..7f41b20b92133 100644 --- a/apps/federation/lib/SyncJob.php +++ b/apps/federation/lib/SyncJob.php @@ -19,6 +19,7 @@ public function __construct(SyncFederationAddressBooks $syncService, LoggerInter 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 376e1049469ee..b2bbe4477dae5 100644 --- a/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php +++ b/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php @@ -13,14 +13,12 @@ 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 69efb664302a9..a332c1434fcbe 100644 --- a/apps/files/lib/BackgroundJob/CleanupFileLocks.php +++ b/apps/files/lib/BackgroundJob/CleanupFileLocks.php @@ -15,20 +15,12 @@ * Clean up all file locks that are expired for the DB file locking provider */ 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 ce2de9a74bbb9..3a7aaa199d1fe 100644 --- a/apps/files/lib/BackgroundJob/DeleteExpiredOpenLocalEditor.php +++ b/apps/files/lib/BackgroundJob/DeleteExpiredOpenLocalEditor.php @@ -11,7 +11,6 @@ use OCA\Files\Db\OpenLocalEditorMapper; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\TimedJob; /** @@ -29,7 +28,7 @@ public function __construct( // 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 b1a795b775cc9..b925974f24a43 100644 --- a/apps/files/lib/BackgroundJob/DeleteOrphanedItems.php +++ b/apps/files/lib/BackgroundJob/DeleteOrphanedItems.php @@ -18,7 +18,6 @@ */ class DeleteOrphanedItems extends TimedJob { public const CHUNK_SIZE = 200; - protected $defaultIntervalMin = 60; /** * sets the correct interval for this timed job @@ -29,7 +28,7 @@ public function __construct( 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 36eaa2d51ceae..6d86c2f347b31 100644 --- a/apps/files_external/lib/BackgroundJob/CredentialsCleanup.php +++ b/apps/files_external/lib/BackgroundJob/CredentialsCleanup.php @@ -12,7 +12,6 @@ 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; @@ -37,7 +36,7 @@ public function __construct( // 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 234e133ffc755..35b72b190e83f 100644 --- a/apps/files_reminders/lib/BackgroundJob/CleanUpReminders.php +++ b/apps/files_reminders/lib/BackgroundJob/CleanUpReminders.php @@ -11,7 +11,6 @@ use OCA\FilesReminders\Service\ReminderService; use OCP\AppFramework\Utility\ITimeFactory; -use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\TimedJob; class CleanUpReminders extends TimedJob { @@ -22,7 +21,7 @@ public function __construct( 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 9b1b0062ce5fd..44b473ac64d61 100644 --- a/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php +++ b/apps/files_sharing/lib/BackgroundJob/FederatedSharesDiscoverJob.php @@ -26,7 +26,8 @@ public function __construct( 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 cd8490291d283..3900225092455 100644 --- a/apps/files_sharing/lib/ExpireSharesJob.php +++ b/apps/files_sharing/lib/ExpireSharesJob.php @@ -7,7 +7,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; @@ -33,7 +32,7 @@ public function __construct(ITimeFactory $time, IManager $shareManager, IDBConne // Run once a day $this->setInterval(24 * 60 * 60); - $this->setTimeSensitivity(IJob::TIME_INSENSITIVE); + $this->setTimeSensitivity(self::TIME_INSENSITIVE); } diff --git a/apps/files_sharing/lib/SharesReminderJob.php b/apps/files_sharing/lib/SharesReminderJob.php index af279bbc146d2..b3b3590ec0954 100644 --- a/apps/files_sharing/lib/SharesReminderJob.php +++ b/apps/files_sharing/lib/SharesReminderJob.php @@ -33,7 +33,7 @@ * Send a reminder via email to the sharee(s) if the folder is still empty a predefined time before the expiration date */ class SharesReminderJob extends TimedJob { - private const SECONDS_BEFORE_REMINDER = 86400; + private const SECONDS_BEFORE_REMINDER = 24 * 60 * 60; private const CHUNK_SIZE = 1000; private int $folderMimeTypeId; @@ -50,7 +50,7 @@ public function __construct( IMimeTypeLoader $mimeTypeLoader, ) { parent::__construct($time); - $this->setInterval(3600); + $this->setInterval(60 * 60); $this->folderMimeTypeId = $mimeTypeLoader->getId(ICacheEntry::DIRECTORY_MIMETYPE); } diff --git a/apps/oauth2/lib/BackgroundJob/CleanupExpiredAuthorizationCode.php b/apps/oauth2/lib/BackgroundJob/CleanupExpiredAuthorizationCode.php index d1647381ffa76..b819a45ace28f 100644 --- a/apps/oauth2/lib/BackgroundJob/CleanupExpiredAuthorizationCode.php +++ b/apps/oauth2/lib/BackgroundJob/CleanupExpiredAuthorizationCode.php @@ -12,7 +12,6 @@ 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; @@ -27,7 +26,7 @@ public function __construct( 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 2bf182d59fd68..61b93803a0d67 100644 --- a/apps/twofactor_backupcodes/lib/BackgroundJob/RememberBackupCodesJob.php +++ b/apps/twofactor_backupcodes/lib/BackgroundJob/RememberBackupCodesJob.php @@ -10,7 +10,6 @@ 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; @@ -43,7 +42,7 @@ public function __construct(IRegistry $registry, $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/BackgroundJob/UpdateAvailableNotifications.php b/apps/updatenotification/lib/BackgroundJob/UpdateAvailableNotifications.php index 30786f5e12d28..7f8402570bc12 100644 --- a/apps/updatenotification/lib/BackgroundJob/UpdateAvailableNotifications.php +++ b/apps/updatenotification/lib/BackgroundJob/UpdateAvailableNotifications.php @@ -40,6 +40,7 @@ public function __construct( 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 b04dc67ef4923..088a563dc2750 100644 --- a/apps/user_ldap/lib/Jobs/CleanUp.php +++ b/apps/user_ldap/lib/Jobs/CleanUp.php @@ -27,7 +27,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 1810f7aa1186c..edf3b65772402 100644 --- a/apps/user_status/lib/BackgroundJob/ClearOldStatusesBackgroundJob.php +++ b/apps/user_status/lib/BackgroundJob/ClearOldStatusesBackgroundJob.php @@ -35,7 +35,7 @@ public function __construct(ITimeFactory $time, $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 0a95bf9157948..85fe836885024 100644 --- a/core/BackgroundJobs/CleanupLoginFlowV2.php +++ b/core/BackgroundJobs/CleanupLoginFlowV2.php @@ -19,7 +19,8 @@ public function __construct( ) { parent::__construct($time); - $this->setInterval(3600); + $this->setInterval(24 * 60 * 60); + $this->setInterval(self::TIME_INSENSITIVE); } protected function run($argument): void { diff --git a/core/BackgroundJobs/GenerateMetadataJob.php b/core/BackgroundJobs/GenerateMetadataJob.php index b3fcf89272002..e775717092abe 100644 --- a/core/BackgroundJobs/GenerateMetadataJob.php +++ b/core/BackgroundJobs/GenerateMetadataJob.php @@ -36,8 +36,8 @@ public function __construct( ) { 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 8449e73983cb7..de7cf549c093a 100644 --- a/lib/private/Preview/BackgroundCleanupJob.php +++ b/lib/private/Preview/BackgroundCleanupJob.php @@ -36,8 +36,8 @@ public function __construct(ITimeFactory $timeFactory, IMimeTypeLoader $mimeTypeLoader, bool $isCLI) { parent::__construct($timeFactory); - // Run at most once an hour - $this->setInterval(3600); + $this->setInterval(24 * 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 e7d981caa08c5..fdf7fb97d3188 100644 --- a/lib/private/Security/Bruteforce/CleanupJob.php +++ b/lib/private/Security/Bruteforce/CleanupJob.php @@ -9,7 +9,6 @@ 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 @@ public function __construct( 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 acec2f46c055d..c6f26e3aa8b65 100644 --- a/lib/private/TaskProcessing/RemoveOldTasksBackgroundJob.php +++ b/lib/private/TaskProcessing/RemoveOldTasksBackgroundJob.php @@ -16,7 +16,7 @@ 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 @@ public function __construct( 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 4a336d56077bb..be5e4127d08fa 100644 --- a/lib/private/TextProcessing/RemoveOldTasksBackgroundJob.php +++ b/lib/private/TextProcessing/RemoveOldTasksBackgroundJob.php @@ -17,7 +17,7 @@ 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 @@ public function __construct( ) { 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 7d9170090b713..225984a7956ff 100644 --- a/lib/private/TextToImage/RemoveOldTasksBackgroundJob.php +++ b/lib/private/TextToImage/RemoveOldTasksBackgroundJob.php @@ -21,7 +21,7 @@ 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 @@ public function __construct( 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 3c1b73637acdb..f999031a2a90a 100644 --- a/lib/private/User/BackgroundJobs/CleanupDeletedUsers.php +++ b/lib/private/User/BackgroundJobs/CleanupDeletedUsers.php @@ -12,7 +12,6 @@ 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 @@ public function __construct( 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 bec3f21fe16df..6a81e84146008 100644 --- a/lib/public/BackgroundJob/TimedJob.php +++ b/lib/public/BackgroundJob/TimedJob.php @@ -52,8 +52,8 @@ public function isTimeSensitive(): bool { * @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'); }