File tree 1 file changed +16
-3
lines changed
packages/core/src/Providers
1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,8 @@ class AWSCloudWatchProvider implements LoggingProvider {
55
55
private _currentLogBatch : InputLogEvent [ ] ;
56
56
private _timer ;
57
57
private _nextSequenceToken : string | undefined ;
58
+ private _maxRetries = 5 ;
59
+ private _retryCount ;
58
60
59
61
constructor ( config ?: AWSCloudWatchProviderOptions ) {
60
62
this . configure ( config ) ;
@@ -494,11 +496,22 @@ class AWSCloudWatchProvider implements LoggingProvider {
494
496
try {
495
497
if ( this . _getDocUploadPermissibility ( ) ) {
496
498
await this . _safeUploadLogEvents ( ) ;
499
+ this . _retryCount = 0 ;
497
500
}
498
501
} catch ( err ) {
499
- logger . error (
500
- `error when calling _safeUploadLogEvents in the timer interval - ${ err } `
501
- ) ;
502
+ this . _retryCount ++ ;
503
+ if ( this . _retryCount < this . _maxRetries ) {
504
+ logger . error (
505
+ `error when calling _safeUploadLogEvents in the timer interval - ${ err } `
506
+ ) ;
507
+ logger . error (
508
+ `Max retries (${ this . _maxRetries } ) reached. Stopping log uploads.`
509
+ ) ;
510
+ } else if ( this . _retryCount == this . _maxRetries ) {
511
+ logger . error (
512
+ `Max retries (${ this . _maxRetries } ) reached. Stopping log uploads.`
513
+ ) ;
514
+ }
502
515
}
503
516
} , 2000 ) ;
504
517
}
You can’t perform that action at this time.
0 commit comments