@samitouri / QOSami-HFS / commits / 41ff5488

fix: avoid possible duplication of some operations like getGateway, getPublicIps, getProjectInfo, renewCert, etc

Massimo Melina committed Apr 5, 2026 at 17:06 UTC 41ff5488d9137aa832a696badc72c5ddb0fec37c
1 file changed +2 -2
src/debounceAsync.ts
+2 -2
@@ -15,7 +15,7 @@ export function debounceAsync<Cancelable extends boolean = false, A extends unkn
15 retain?: number,
16 // for how long do you want to cache last failure value, and return that at next invocation?
17 retainFailure?: number,
18 - // if a call is overlapping another, return the same promise, instead of queuing
18 + // if a call is overlapping another, return the same promise, instead of queuing. It's automatically on if you have retain or retainFailure.
19 reuseRunning?: boolean,
20 // should we offer a cancel method to the returned function? if we do, the awaited-type will include undefined
21 cancelable?: Cancelable
@@ -23,7 +23,7 @@ export function debounceAsync<Cancelable extends boolean = false, A extends unkn
23 ) {
24 type MaybeUndefined<T> = Cancelable extends true ? undefined | T : T
25 type MaybeR = MaybeUndefined<R>
26 - const { wait=0, leading=false, maxWait=Infinity, cancelable=false, retain=0, retainFailure, reuseRunning } = options
26 + const { wait=0, leading=false, maxWait=Infinity, cancelable=false, retain=0, retainFailure, reuseRunning=Boolean(retain || retainFailure) } = options
27 let started = 0 // latest callback invocation
28 let runningCallback: Promise<R> | undefined // latest callback invocation result
29 let latestDebouncer: Promise<MaybeR | R> // latest wrapper invocation