Allow users to optionally specify a maximum number of
attempts to send in case of retryable errors, instead
of retrying indefinitely.
The logger will accept an integer "maxAttempts" option,
which gives the total number of attempts (including
the first) when retryable errors are encountered.
When the limit is reached, errors that would otherwise
be considered retryable are instead treated as non-retryable.
If "maxAttempts" is negative (or not specified),
the logger will continue to retry indefinitely.
lib/logger.js: Add definitions and initialization for
maxAttempts. Add convenience method _shouldRetry() to
determine whether or not to retry given a specific
error code.
lib/constants.js: Add MAX_ATTEMPTS default value.
test/common/create-options.js: Added check for default
value of maxAttempts.
test/logger-errors.js: Add a test to verify that retries
are limited.
test/logger-instantiation.js: Add a test for maxAttempts
option validation.
test/common/create-options.js: Update test support code.
README.md: Add description of maxAttempts.
types.d.ts: Added typescript definitions for maxAttempts.
Allow users to optionally specify a maximum number of attempts to send in case of retryable errors, instead of retrying indefinitely.
The logger will accept an integer "maxAttempts" option, which gives the total number of attempts (including the first) when retryable errors are encountered.
When the limit is reached, errors that would otherwise be considered retryable are instead treated as non-retryable.
If "maxAttempts" is negative (or not specified), the logger will continue to retry indefinitely.
lib/logger.js: Add definitions and initialization for maxAttempts. Add convenience method _shouldRetry() to determine whether or not to retry given a specific error code.
lib/constants.js: Add MAX_ATTEMPTS default value.
test/common/create-options.js: Added check for default value of maxAttempts.
test/logger-errors.js: Add a test to verify that retries are limited.
test/logger-instantiation.js: Add a test for maxAttempts option validation.
test/common/create-options.js: Update test support code.
README.md: Add description of maxAttempts.
types.d.ts: Added typescript definitions for maxAttempts.
Fixes: #58