Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
apollo-link-retry
Advanced tools
An Apollo Link to allow multiple attempts when an operation has failed. One such use case is to try a request while a network connection is offline and retry until it comes back online. You can configure a RetryLink to vary the number of times it retries and how long it waits between retries through its configuration.
npm install apollo-link-retry --save
import { RetryLink } from "apollo-link-retry";
const link = new RetryLink();
Retry Link takes an object with three options on it to customize the behavior of the link.
Retry Link retries on network errors only, not on GraphQL errors.
The default delay algorithm is to wait delay
ms between each retry. You can customize the algorithm (eg, replacing with exponential backoff) with the interval
option. The possible values for the configuration object are as follow:
max
: a number or function matching (Operation => number) to determine the max number of times to try a single operation before giving up. It defaults to 10delay
: a number or function matching (Operation => number) to input to the interval function below: Defaults to 300 msinterval
: a function matching (delay: number, count: number) => number which is the amount of time (in ms) to wait before the next attempt; count is the number of requests previously triedimport { RetryLink } from "apollo-link-retry";
const max = (operation) => operation.getContext().max;
const delay = 5000;
const interval = (delay, count) => {
if (count > 5) return 10000;
return delay;
}
const link = new RetryLink({
max,
delay,
interval
});
The Retry Link does not use the context for anything.
FAQs
Retry Apollo Link for GraphQL Network Stack
We found that apollo-link-retry demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.