![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@teneff/with-retry
Advanced tools
Retry async functions when error happens
Type: object
Type: number
(default: 2
)
Specifies the maximum amount of calls to the decorated function.
Type: Error[]
(default: [Error]
)
Specifies an array of errors for which the function should be retried. If the default option is used it will be retried for every error.
Type: number | ({ call: number; errors: Error[] }) => number
(default: 0)
Specifies amount of delay before each retry.
number
is given after each Error the subsequent invocation will be delayed with a fixed amount.function
returning number
is given it will invoke the function and delay the invocations by the resultimport got from 'got'
import withRetry from '@teneff/with-retry'
@withRetry({
maxCalls: 5,
errors: [got.TimeoutError],
})
export default function getFlakyServiceData() {
return await got("https://example.com");
}
import got from "got";
import withRetry from "@teneff/with-retry";
function getFlakyServiceData() {
return await got("https://example.com");
}
export default withRetry({
maxCalls: 5,
errors: [got.TimeoutError],
})(getFlakyServiceData);
import got from "got";
import withRetry from '@teneff/with-retry/decorator'
class Example
@withRetry({
maxCalls: 5,
errors: [got.TimeoutError],
})
getFlakyServiceData() {
return await got("https://example.com");
}
}
Adds support for unknown errors
import withRetry, { UnknownError } from "@teneff/with-retry";
function resolvesPromiseWithNonError() {
return Promise.reject("a string");
}
await withRetry({
errors: UnknownError,
})(resolvesPromiseWithNonError)();
Fixes issue #6 preserving class context
class Example {
private mockCallback = jest
.fn()
.mockRejectedValueOnce(new Error(`[${num}] mock error`))
.mockResolvedValue(`[${num}] success`);
@withRetry({
maxCalls: 4,
})
getData2(): Promise<string> {
return this.mockCallback("arg1", "arg2");
}
}
FAQs
Decorator for retrying async operations
The npm package @teneff/with-retry receives a total of 120 weekly downloads. As such, @teneff/with-retry popularity was classified as not popular.
We found that @teneff/with-retry demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.