Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/notifications.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2021-10-19 18:01:26 +0300
committerJohn Molakvoæ (Rebase PR Action) <skjnldsv@users.noreply.github.com>2021-10-23 11:56:40 +0300
commit6c5b01e3c3a5a59172232c9ba0d90d8982814684 (patch)
tree042573e54b88b6c24683dcf45c4f9dac8e7acfd2 /lib
parent2d5f4efcbe7bdc9c6fdcdb10effcdf484ca47d48 (diff)
Fair use of push notifications
We want to keep offering our push notification service for free, but large users overload our infrastructure. For this reason we have to rate-limit the use of push notifications. If you need this feature, consider setting up your own push server or using Nextcloud Enterprise. Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Command/TestPush.php8
-rw-r--r--lib/Push.php10
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/Command/TestPush.php b/lib/Command/TestPush.php
index 11ca7eb..d4533a3 100644
--- a/lib/Command/TestPush.php
+++ b/lib/Command/TestPush.php
@@ -85,6 +85,14 @@ class TestPush extends Command {
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output): int {
+ if (!$this->notificationManager->isFairUseOfFreePushService()) {
+ $output->writeln('<error>We want to keep offering our push notification service for free, but large</error>');
+ $output->writeln('<error>users overload our infrastructure. For this reason we have to rate-limit the</error>');
+ $output->writeln('<error>use of push notifications. If you need this feature, consider setting up your</error>');
+ $output->writeln('<error>own push server or using Nextcloud Enterprise.</error>');
+ return 1;
+ }
+
$userId = $input->getArgument('user-id');
$subject = 'Testing push notifications';
diff --git a/lib/Push.php b/lib/Push.php
index af3d0a2..1405297 100644
--- a/lib/Push.php
+++ b/lib/Push.php
@@ -295,6 +295,16 @@ class Push {
return;
}
+ if (!$this->notificationManager->isFairUseOfFreePushService()) {
+ /**
+ * We want to keep offering our push notification service for free, but large
+ * users overload our infrastructure. For this reason we have to rate-limit the
+ * use of push notifications. If you need this feature, consider setting up your
+ * own push server or using Nextcloud Enterprise.
+ */
+ return;
+ }
+
$client = $this->clientService->newClient();
foreach ($pushNotifications as $proxyServer => $notifications) {
try {