diff --git a/src/Jobs/AbstractNotification.php b/src/Jobs/AbstractNotification.php index 4440f6b..346e8fd 100644 --- a/src/Jobs/AbstractNotification.php +++ b/src/Jobs/AbstractNotification.php @@ -3,7 +3,7 @@ /* * This file is part of SeAT * - * Copyright (C) 2015 to 2022 Leon Jacobs + * Copyright (C) 2015 to present Leon Jacobs * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,13 +38,6 @@ abstract class AbstractNotification extends AbstractNotificationJob */ public $queue = 'notifications'; - /** - * The number of times the job may be attempted. - * - * @var int - */ - public $tries = 2; - public $mentions; /** @@ -55,6 +48,16 @@ abstract class AbstractNotification extends AbstractNotificationJob */ abstract public function via($notifiable); + /** + * The maximum number of unhandled exceptions to allow before failing. + * The rate limiter can delay it many times, so $tries is not optimal + * At the same time, retryUntil is not wise either, as it might keep spamming discord's server with erroneous requests. + * $maxExceptions is perfect: the rate limiter can do his job, and we fail with errors. + * + * @var int + */ + public $maxExceptions = 3; + /** * @return mixed */ diff --git a/src/Jobs/AbstractNotificationJob.php b/src/Jobs/AbstractNotificationJob.php index a211668..ab6001d 100644 --- a/src/Jobs/AbstractNotificationJob.php +++ b/src/Jobs/AbstractNotificationJob.php @@ -3,7 +3,7 @@ /* * This file is part of SeAT * - * Copyright (C) 2015 to 2022 Leon Jacobs + * Copyright (C) 2015 to present Leon Jacobs * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/Notifications/AbstractDiscordNotification.php b/src/Notifications/AbstractDiscordNotification.php index dd77ec1..7dd7020 100644 --- a/src/Notifications/AbstractDiscordNotification.php +++ b/src/Notifications/AbstractDiscordNotification.php @@ -3,7 +3,7 @@ /* * This file is part of SeAT * - * Copyright (C) 2015 to 2022 Leon Jacobs + * Copyright (C) 2015 to present Leon Jacobs * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ abstract class AbstractDiscordNotification extends AbstractNotification { public const RATE_LIMIT_KEY = 'discord_webhook'; - public const RATE_LIMIT = 50; //https://discord.com/developers/docs/topics/rate-limits#global-rate-limit + public const RATE_LIMIT = 45; //https://discord.com/developers/docs/topics/rate-limits#global-rate-limit, but stay a bit below it public function middleware(): array { diff --git a/src/Services/Discord/Channels/DiscordWebhookChannel.php b/src/Services/Discord/Channels/DiscordWebhookChannel.php index cdc9052..2125a5a 100644 --- a/src/Services/Discord/Channels/DiscordWebhookChannel.php +++ b/src/Services/Discord/Channels/DiscordWebhookChannel.php @@ -3,7 +3,7 @@ /* * This file is part of SeAT * - * Copyright (C) 2015 to 2022 Leon Jacobs + * Copyright (C) 2015 to present Leon Jacobs * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -133,7 +133,7 @@ private function fields(DiscordEmbed $embed) return $value->toArray(); return [ - 'title' => $title, + 'name' => $title, 'value' => $value, 'inline' => true, ];