Product
Introducing Ruby Support in Socket
Socket is launching Ruby support for all users. Enhance your Rails projects with AI-powered security scans for vulnerabilities and supply chain threats. Now in Beta!
@aws-sdk/util-retry
Advanced tools
The @aws-sdk/util-retry package is part of the AWS SDK for JavaScript v3. It provides utilities to add retry functionality to the AWS SDK operations. This package is designed to help manage retries in a more efficient and customizable way, allowing developers to handle transient errors by repeating requests without having to implement their own retry logic.
Configuring retry strategies
This feature allows developers to configure retry strategies, specifying how many times an operation should be retried before giving up. The `StandardRetryStrategy` is a built-in strategy that can be used to automatically handle retries according to the SDK's standard logic.
const { StandardRetryStrategy } = require('@aws-sdk/util-retry');
const retryStrategy = new StandardRetryStrategy(maxAttempts);
Custom retry strategy
Developers can extend the `RetryStrategy` class to implement custom retry logic. This allows for fine-grained control over when and how retries should be performed, based on the specific needs of the application.
const { RetryStrategy } = require('@aws-sdk/util-retry');
class MyRetryStrategy extends RetryStrategy {
constructor(maxAttempts) {
super();
this.maxAttempts = maxAttempts;
}
shouldRetry(error) {
// Custom logic to determine if a retry should be attempted
}
delayBeforeNextRetry(retryCount) {
// Custom logic to determine the delay before the next retry
}
}
The `retry` package provides a simple, yet powerful abstraction for retrying asynchronous operations. Unlike @aws-sdk/util-retry, which is designed specifically for AWS SDK operations, `retry` can be used for any asynchronous operation, making it more versatile but less specialized.
Similar to `retry`, `async-retry` is a lightweight library for retrying promises. It offers a simple API and flexible configuration options. While `async-retry` is more focused on promise-based operations, @aws-sdk/util-retry is tailored for AWS SDK operations, providing more specific functionalities for handling AWS service interactions.
The `p-retry` package is designed for retrying promises with a specific focus on simplicity and composability. It uses a declarative approach for defining retry conditions and strategies. Compared to @aws-sdk/util-retry, `p-retry` is more generic and can be applied to any promise-based operation, not just AWS SDK calls.
An internal package
This package provides shared utilities for retries.
You probably shouldn't, at least directly.
3.222.0 (2022-12-01)
FAQs
Shared retry utilities to be used in middleware packages.
The npm package @aws-sdk/util-retry receives a total of 932,243 weekly downloads. As such, @aws-sdk/util-retry popularity was classified as popular.
We found that @aws-sdk/util-retry demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket is launching Ruby support for all users. Enhance your Rails projects with AI-powered security scans for vulnerabilities and supply chain threats. Now in Beta!
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.