Automatic retry plugin for Spoosh with configurable attempts and delay
npm install @spoosh/plugin-retryAutomatic retry plugin for Spoosh with configurable attempts and delay.
Documentation · Requirements: TypeScript >= 5.0 · Peer Dependencies: @spoosh/core
``bash`
npm install @spoosh/plugin-retry
`typescript
import { Spoosh } from "@spoosh/core";
import { retryPlugin } from "@spoosh/plugin-retry";
const spoosh = new Spoosh
retryPlugin({ retries: 3, retryDelay: 1000 }),
]);
// Per-query override
useRead((api) => api("posts").GET(), { retries: 5, retryDelay: 2000 });
// Disable retries for a specific request
useRead((api) => api("posts").GET(), { retries: false });
`
| Option | Type | Default | Description |
| ------------ | ----------------- | ------- | ------------------------------------------------------------ |
| retries | number \| false | 3 | Number of retry attempts. Set to false to disable retries. |retryDelay
| | number | 1000 | Delay between retries in milliseconds |
| Option | Type | Description |
| ------------ | ----------------- | ---------------------------------------- |
| retries | number \| false | Override retry attempts for this request |retryDelay
| | number` | Override retry delay for this request |