diff options
author | Vitor Mattos <vitor@php.rio> | 2022-02-17 20:28:23 +0300 |
---|---|---|
committer | Vitor Mattos <vitor@php.rio> | 2022-02-22 19:14:11 +0300 |
commit | 726950755436ddd2260494243721caf94f62c7dc (patch) | |
tree | ca33a8c7f9d06c65270dd41d786374d1e5982ea4 /lib | |
parent | 4080f6d0905c60741c5acfcfd976e8d4cb226cdc (diff) |
Define if job is time sensitive
Signed-off-by: Vitor Mattos <vitor@php.rio>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/BackgroundJob/CheckHostedSignalingServer.php | 5 | ||||
-rw-r--r-- | lib/BackgroundJob/CheckMatterbridges.php | 2 | ||||
-rw-r--r-- | lib/BackgroundJob/CheckReferenceIdColumn.php | 4 | ||||
-rw-r--r-- | lib/BackgroundJob/ExpireSignalingMessage.php | 3 | ||||
-rw-r--r-- | lib/BackgroundJob/RemoveEmptyRooms.php | 2 | ||||
-rw-r--r-- | lib/BackgroundJob/ResetAssignedSignalingServer.php | 2 |
6 files changed, 18 insertions, 0 deletions
diff --git a/lib/BackgroundJob/CheckHostedSignalingServer.php b/lib/BackgroundJob/CheckHostedSignalingServer.php index 4d0671679..48a91f54d 100644 --- a/lib/BackgroundJob/CheckHostedSignalingServer.php +++ b/lib/BackgroundJob/CheckHostedSignalingServer.php @@ -29,6 +29,7 @@ use OCA\Talk\DataObjects\AccountId; use OCA\Talk\Exceptions\HostedSignalingServerAPIException; use OCA\Talk\Service\HostedSignalingServerService; use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\TimedJob; use OCP\IConfig; use OCP\IGroup; @@ -60,7 +61,11 @@ class CheckHostedSignalingServer extends TimedJob { IURLGenerator $urlGenerator, LoggerInterface $logger) { parent::__construct($timeFactory); + + // Every hour $this->setInterval(3600); + $this->setTimeSensitivity(IJob::TIME_SENSITIVE); + $this->hostedSignalingServerService = $hostedSignalingServerService; $this->config = $config; $this->notificationManager = $notificationManager; diff --git a/lib/BackgroundJob/CheckMatterbridges.php b/lib/BackgroundJob/CheckMatterbridges.php index 65dfec841..0dae15d04 100644 --- a/lib/BackgroundJob/CheckMatterbridges.php +++ b/lib/BackgroundJob/CheckMatterbridges.php @@ -25,6 +25,7 @@ namespace OCA\Talk\BackgroundJob; use OCA\Talk\MatterbridgeManager; use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\TimedJob; use OCP\IConfig; use Psr\Log\LoggerInterface; @@ -53,6 +54,7 @@ class CheckMatterbridges extends TimedJob { // Every 15 minutes $this->setInterval(60 * 15); + $this->setTimeSensitivity(IJob::TIME_SENSITIVE); $this->serverConfig = $serverConfig; $this->bridgeManager = $bridgeManager; diff --git a/lib/BackgroundJob/CheckReferenceIdColumn.php b/lib/BackgroundJob/CheckReferenceIdColumn.php index 36cfc07ec..53414ad87 100644 --- a/lib/BackgroundJob/CheckReferenceIdColumn.php +++ b/lib/BackgroundJob/CheckReferenceIdColumn.php @@ -26,6 +26,7 @@ namespace OCA\Talk\BackgroundJob; use OC\DB\ConnectionAdapter; use OC\DB\SchemaWrapper; use OCP\AppFramework\Utility\ITimeFactory; +use OCP\BackgroundJob\IJob; use OCP\BackgroundJob\IJobList; use OCP\BackgroundJob\TimedJob; use OCP\IConfig; @@ -53,7 +54,10 @@ class CheckReferenceIdColumn extends TimedJob { $this->jobList = $jobList; $this->serverConfig = $serverConfig; $this->connection = $connection; + + // Every hour $this->setInterval(3600); + $this->setTimeSensitivity(IJob::TIME_INSENSITIVE); } protected function run($argument): void { diff --git a/lib/BackgroundJob/ExpireSignalingMessage.php b/lib/BackgroundJob/ExpireSignalingMessage.php index 24cb99c2d..3b0e26f03 100644 --- a/lib/BackgroundJob/ExpireSignalingMessage.php +++ b/lib/BackgroundJob/ExpireSignalingMessage.php @@ -26,6 +26,7 @@ namespace OCA\Talk\BackgroundJob; use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\TimedJob; use OCA\Talk\Signaling\Messages; +use OCP\BackgroundJob\IJob; /** * Class ExpireSignalingMessage @@ -43,11 +44,13 @@ class ExpireSignalingMessage extends TimedJob { // Every 5 minutes $this->setInterval(60 * 5); + $this->setTimeSensitivity(IJob::TIME_SENSITIVE); $this->messages = $messages; } protected function run($argument): void { + // Older than 5 minutes $this->messages->expireOlderThan(5 * 60); } } diff --git a/lib/BackgroundJob/RemoveEmptyRooms.php b/lib/BackgroundJob/RemoveEmptyRooms.php index 15a7a2cc5..bff2d321b 100644 --- a/lib/BackgroundJob/RemoveEmptyRooms.php +++ b/lib/BackgroundJob/RemoveEmptyRooms.php @@ -28,6 +28,7 @@ use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\TimedJob; use OCA\Talk\Manager; use OCA\Talk\Room; +use OCP\BackgroundJob\IJob; use OCP\Files\Config\IUserMountCache; use Psr\Log\LoggerInterface; @@ -61,6 +62,7 @@ class RemoveEmptyRooms extends TimedJob { // Every 5 minutes $this->setInterval(60 * 5); + $this->setTimeSensitivity(IJob::TIME_INSENSITIVE); $this->manager = $manager; $this->participantService = $participantService; diff --git a/lib/BackgroundJob/ResetAssignedSignalingServer.php b/lib/BackgroundJob/ResetAssignedSignalingServer.php index 88dc6aa19..6b9c77c2a 100644 --- a/lib/BackgroundJob/ResetAssignedSignalingServer.php +++ b/lib/BackgroundJob/ResetAssignedSignalingServer.php @@ -26,6 +26,7 @@ namespace OCA\Talk\BackgroundJob; use OCP\AppFramework\Utility\ITimeFactory; use OCP\BackgroundJob\TimedJob; use OCA\Talk\Manager; +use OCP\BackgroundJob\IJob; use OCP\ICache; use OCP\ICacheFactory; @@ -43,6 +44,7 @@ class ResetAssignedSignalingServer extends TimedJob { // Every 5 minutes $this->setInterval(60 * 5); + $this->setTimeSensitivity(IJob::TIME_SENSITIVE); $this->manager = $manager; $this->cache = $cacheFactory->createDistributed('hpb_servers'); |