@@ -58,7 +58,7 @@ class AWSCloudWatchProvider implements LoggingProvider {
58
58
private _maxRetries = 5 ;
59
59
private _retryCount ;
60
60
private _lastAttemptTime : number = 0 ;
61
- private _resetInterval : number = 5 * 60 * 1000 ; // 5 minutes
61
+ private _resetInterval : number = 1 * 60 * 1000 ; // 1 minutes
62
62
63
63
constructor ( config ?: AWSCloudWatchProviderOptions ) {
64
64
this . configure ( config ) ;
@@ -497,24 +497,23 @@ class AWSCloudWatchProvider implements LoggingProvider {
497
497
this . _timer = setInterval ( async ( ) => {
498
498
const now = Date . now ( ) ;
499
499
500
- // Reset retry count if enough time has passed since last attempt
500
+ // Time-based reset
501
501
if ( now - this . _lastAttemptTime > this . _resetInterval ) {
502
502
this . _retryCount = 0 ;
503
503
}
504
504
505
505
this . _lastAttemptTime = now ;
506
506
507
- if ( ! this . _getDocUploadPermissibility ( ) ) {
508
- return ; // Skip this iteration if upload is not permissible
509
- }
510
507
try {
511
- await this . _safeUploadLogEvents ( ) ;
512
- if ( this . _retryCount > 0 ) {
513
- logger . info (
514
- 'CloudWatch log upload succeeded after previous failures.'
515
- ) ;
508
+ if ( this . _getDocUploadPermissibility ( ) ) {
509
+ await this . _safeUploadLogEvents ( ) ;
510
+ this . _retryCount = 0 ; // Reset on success
511
+ if ( this . _retryCount > 0 ) {
512
+ logger . info (
513
+ 'CloudWatch log upload succeeded after previous failures.'
514
+ ) ;
515
+ }
516
516
}
517
- this . _retryCount = 0 ; // Reset on success
518
517
} catch ( err ) {
519
518
this . _retryCount ++ ;
520
519
if ( this . _retryCount <= this . _maxRetries ) {
@@ -524,11 +523,11 @@ class AWSCloudWatchProvider implements LoggingProvider {
524
523
525
524
if ( this . _retryCount === this . _maxRetries ) {
526
525
logger . error (
527
- `CloudWatch log upload failed after ${ this . _maxRetries } attempts . Suppressing further error logs. Upload attempts will continue in the background.`
526
+ `Max retries ( ${ this . _maxRetries } ) reached . Suppressing further error logs. Upload attempts will continue in the background.`
528
527
) ;
529
528
}
530
529
}
531
- // After max retries, we're still attempting uploads but not logging errors
530
+ // Silently continue attempts after max retries
532
531
}
533
532
} , 2000 ) ;
534
533
}
0 commit comments