@camera.ui/transport 0.0.18 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/effects/backoff.d.ts +1 -0
- package/dist/index.js +3 -1
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ export type Detach = () => void;
|
|
|
3
3
|
export interface BackoffOptions {
|
|
4
4
|
readonly kernel: Kernel;
|
|
5
5
|
readonly schedule?: readonly number[];
|
|
6
|
+
readonly firstAttemptDelayMs?: () => number | null | undefined;
|
|
6
7
|
readonly now?: () => number;
|
|
7
8
|
readonly setTimer?: (cb: () => void, ms: number) => unknown;
|
|
8
9
|
readonly clearTimer?: (handle: unknown) => void;
|
package/dist/index.js
CHANGED
|
@@ -291,7 +291,9 @@ function attachBackoff(options) {
|
|
|
291
291
|
}
|
|
292
292
|
function scheduleFromPhase(phase, isReschedule) {
|
|
293
293
|
cancelTimer(isReschedule ? "rescheduled" : void 0);
|
|
294
|
-
const
|
|
294
|
+
const baseDelay = schedule[Math.min(attempt, schedule.length - 1)];
|
|
295
|
+
const quick = attempt === 0 ? options.firstAttemptDelayMs?.() : void 0;
|
|
296
|
+
const scheduleDelay = typeof quick === "number" && quick >= 0 ? Math.min(quick, baseDelay) : baseDelay;
|
|
295
297
|
const phaseDelay = Math.max(0, phase.nextRetryAt - now());
|
|
296
298
|
const delay = Math.max(scheduleDelay, phaseDelay);
|
|
297
299
|
options.onScheduled?.(attempt + 1, delay);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camera.ui/transport",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"description": "camera.ui transport layer — framework-agnostic connection kernel, reducer state, pluggable transports (HTTP/WS/Socket.IO/NATS), lifecycle effects and worker bridge",
|
|
5
5
|
"author": "seydx (https://github.com/cameraui/clients)",
|
|
6
6
|
"type": "module",
|