Extending options to allow customizing fetch options / added request retry to make plugin more failure resistant to temporary network failure, server timeouts, etc... #71
fetchOptions: This allows the user of the plugin to customize options passed to node fetch, e.g. to specify an increased timeout etc...
retryOptions: Allows the user to pass in options for p-retry, enabling for making the plugin more failure resistant to temporary network failure, server timeouts, etc...
In addition, it wraps the fetch call to the GrapQL API in a p-retry, so that the user can specify a retry behavior with the above mentioned retryOptions option.
Note: the default value for retryOptions was set to { retries: 1 } to minimize change in behaviour to the plugin.
Description
This small PR adds two options to the plugin:
fetchOptions
: This allows the user of the plugin to customize options passed to node fetch, e.g. to specify an increased timeout etc...retryOptions
: Allows the user to pass in options forp-retry
, enabling for making the plugin more failure resistant to temporary network failure, server timeouts, etc...In addition, it wraps the fetch call to the GrapQL API in a
p-retry
, so that the user can specify a retry behavior with the above mentionedretryOptions
option. Note: the default value forretryOptions
was set to{ retries: 1 }
to minimize change in behaviour to the plugin.Related issues
https://github.com/craftcms/gatsby-source-craft/issues/67