graphql-directive-retry
Instead of adding retry logic inside the resolver implementation, use this schema directive to add retry declaratively
Usage
const retryDirective retryDeclaration = ;const makeExecutableSchema = ;const graphql = ; const typeDefs = ` type Query { flakyFunction(arg: String!): String! @retry(maxTimeout: 100) }`;
Customizing timeout behavior
This directive is based on promise-retry and you can use the same configuration options.
Field Config
You can configure retry behavior on a per-field basis like this:
type Query {
flakyFunction(arg: String!): String!
@retry(retries: 1, minTimeout: 100, maxTimeout: 200, factor: 1.1)
}
Global Config
You can configure the default retry behavior for all resovlers with a retry directive by providing the configuration in the execution context. Here is an example:
const response = await ;