Skip to content

Commit 3ba6b64

Browse files
committed
stops after retries reached maximum number
1 parent 6d98cda commit 3ba6b64

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

packages/core/src/Providers/AWSCloudWatchProvider.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -496,19 +496,19 @@ class AWSCloudWatchProvider implements LoggingProvider {
496496
try {
497497
if (this._getDocUploadPermissibility()) {
498498
await this._safeUploadLogEvents();
499-
this._retryCount = 0;
500499
}
501500
} catch (err) {
502501
this._retryCount++;
503-
if (this._retryCount < this._maxRetries) {
502+
if (this._retryCount > this._maxRetries) {
504503
logger.error(
505-
`error when calling _safeUploadLogEvents in the timer interval - ${err}`
506-
);
507-
} else if (this._retryCount === this._maxRetries) {
508-
logger.error(
509-
`CloudWatch log upload failed after ${this._maxRetries} attempts. Suppressing further error logs. Upload attempts will continue in the background.`
504+
`Max retries (${this._maxRetries}) reached. Stopping log uploads.`
510505
);
506+
clearInterval(this._timer);
507+
return;
511508
}
509+
logger.error(
510+
`error when calling _safeUploadLogEvents in the timer interval - ${err}`
511+
);
512512
}
513513
}, 2000);
514514
}

0 commit comments

Comments
 (0)