@based/client
Advanced tools
Comparing version 6.5.2 to 6.6.0
@@ -282,4 +282,7 @@ import connectWebsocket from './websocket/index.js'; | ||
let retries = 0; | ||
const retryReject = (err) => { | ||
const newTime = retryStrategy(err, time, retries); | ||
const retryReject = async (err) => { | ||
const result = await retryStrategy(err, time, retries); | ||
const isObj = typeof result === 'object'; | ||
const newPayload = (isObj ? result.payload : payload) ?? payload; | ||
const newTime = isObj ? result.time : result; | ||
retries++; | ||
@@ -289,7 +292,7 @@ if (typeof newTime === 'number' && !isNaN(newTime)) { | ||
if (newTime === 0) { | ||
addToFunctionQueue(this, payload, name, resolve, retryReject); | ||
addToFunctionQueue(this, newPayload, name, resolve, retryReject); | ||
} | ||
else { | ||
setTimeout(() => { | ||
addToFunctionQueue(this, payload, name, resolve, retryReject); | ||
addToFunctionQueue(this, newPayload, name, resolve, retryReject); | ||
}, newTime); | ||
@@ -296,0 +299,0 @@ } |
@@ -9,4 +9,9 @@ import { GenericObject } from './generic.js'; | ||
export type FunctionQueue = FunctionQueueItem[]; | ||
export type RetryResult = { | ||
payload?: any; | ||
time?: number; | ||
}; | ||
export type RetryResultAll = RetryResult | null | undefined | false | number; | ||
export type CallOptions = { | ||
retryStrategy: (err: Error, time: number, retries: number) => 0 | null | undefined | false | number; | ||
retryStrategy: (err: Error, time: number, retries: number) => Promise<RetryResultAll> | RetryResultAll; | ||
}; | ||
@@ -13,0 +18,0 @@ export type QueryOptions = { |
{ | ||
"name": "@based/client", | ||
"version": "6.5.2", | ||
"version": "6.6.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
230805
3654