From 4e9a48bac5d823d008bd5fb18cb08526828b5543 Mon Sep 17 00:00:00 2001 From: Crypta Eve Date: Wed, 26 Jun 2024 22:41:39 +0930 Subject: [PATCH] feat: limit number of exceptions within jobs --- src/Jobs/EsiBase.php | 7 +++++++ src/Jobs/Market/History.php | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/Jobs/EsiBase.php b/src/Jobs/EsiBase.php index 305f033d..69cdb83f 100644 --- a/src/Jobs/EsiBase.php +++ b/src/Jobs/EsiBase.php @@ -70,6 +70,13 @@ abstract class EsiBase extends AbstractJob 'invalid_grant: Invalid refresh token. Token missing/expired.', ]; + /** + * The maximum number of unhandled exceptions to allow before failing. + * + * @var int + */ + public $maxExceptions = 3; + /** * @var string By default, queue all ESI jobs on public queue. */ diff --git a/src/Jobs/Market/History.php b/src/Jobs/Market/History.php index 8d13f5d6..08bfa54c 100644 --- a/src/Jobs/Market/History.php +++ b/src/Jobs/Market/History.php @@ -63,6 +63,18 @@ class History extends EsiBase */ const ENDPOINT_RATE_LIMIT_CALLS = 100; + /** + * The maximum number of unhandled exceptions to allow before failing. + * + * Override base attempts limit and allow the job to be retried up to 100 times. + * This value is tied to the amount of requests which should be done against ESI + * in order to process a complete batch. + * + * + * @var int + */ + public $maxExceptions = 100; + /** * @var string */