diff options
author | Joas Schilling <coding@schilljs.com> | 2021-07-16 16:55:23 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-07-16 16:58:09 +0200 |
commit | 9b128d823b816c71348f4580b2c00247ee8fa1ec (patch) | |
tree | 9a130ee46cfad4e83e0ba416e4adc5b433a71c56 /apps/updatenotification/lib | |
parent | 2766df9764bd04250492c561ef24a271a7d03bea (diff) | |
download | nextcloud-server-9b128d823b816c71348f4580b2c00247ee8fa1ec.tar.gz nextcloud-server-9b128d823b816c71348f4580b2c00247ee8fa1ec.zip |
Jitter the requests to the appstore and updater server over 3 minutes
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/updatenotification/lib')
-rw-r--r-- | apps/updatenotification/lib/Notification/BackgroundJob.php | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/apps/updatenotification/lib/Notification/BackgroundJob.php b/apps/updatenotification/lib/Notification/BackgroundJob.php index be02c9fa686..e7dc193df6c 100644 --- a/apps/updatenotification/lib/Notification/BackgroundJob.php +++ b/apps/updatenotification/lib/Notification/BackgroundJob.php @@ -60,17 +60,12 @@ class BackgroundJob extends TimedJob { /** @var string[] */ protected $users; - /** - * NotificationBackgroundJob constructor. - * - * @param IConfig $config - * @param IManager $notificationManager - * @param IGroupManager $groupManager - * @param IAppManager $appManager - * @param IClientService $client - * @param Installer $installer - */ - public function __construct(IConfig $config, IManager $notificationManager, IGroupManager $groupManager, IAppManager $appManager, IClientService $client, Installer $installer) { + public function __construct(IConfig $config, + IManager $notificationManager, + IGroupManager $groupManager, + IAppManager $appManager, + IClientService $client, + Installer $installer) { // Run once a day $this->setInterval(60 * 60 * 24); @@ -83,6 +78,16 @@ class BackgroundJob extends TimedJob { } protected function run($argument) { + if (\OC::$CLI && !$this->config->getSystemValueBool('debug', false)) { + try { + // Jitter the pinging of the updater server and the appstore a bit. + // Otherwise all Nextcloud installations are pinging the servers + // in one of 288 + sleep(random_int(1, 180)); + } catch (\Exception $e) { + } + } + $this->checkCoreUpdate(); $this->checkAppUpdates(); } |