From 3ba6b64ff84640528d24211d3dd4912a3af44c27 Mon Sep 17 00:00:00 2001 From: yuhengshs Date: Mon, 16 Sep 2024 14:14:23 -0700 Subject: [PATCH] stops after retries reached maximum number --- .../core/src/Providers/AWSCloudWatchProvider.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/core/src/Providers/AWSCloudWatchProvider.ts b/packages/core/src/Providers/AWSCloudWatchProvider.ts index 37d4a688649..30c52ec6386 100644 --- a/packages/core/src/Providers/AWSCloudWatchProvider.ts +++ b/packages/core/src/Providers/AWSCloudWatchProvider.ts @@ -496,19 +496,19 @@ class AWSCloudWatchProvider implements LoggingProvider { try { if (this._getDocUploadPermissibility()) { await this._safeUploadLogEvents(); - this._retryCount = 0; } } catch (err) { this._retryCount++; - if (this._retryCount < this._maxRetries) { + if (this._retryCount > this._maxRetries) { logger.error( - `error when calling _safeUploadLogEvents in the timer interval - ${err}` - ); - } else if (this._retryCount === this._maxRetries) { - logger.error( - `CloudWatch log upload failed after ${this._maxRetries} attempts. Suppressing further error logs. Upload attempts will continue in the background.` + `Max retries (${this._maxRetries}) reached. Stopping log uploads.` ); + clearInterval(this._timer); + return; } + logger.error( + `error when calling _safeUploadLogEvents in the timer interval - ${err}` + ); } }, 2000); }