quak backup retries failed requests for longer (closes #165)
check / check (push) Successful in 4m16s
check / check (push) Successful in 4m16s
src/retry.ts exports UNATTENDED_RETRY_OPTIONS beside the unchanged default: 10 attempts, a 1 s base delay and a 60 s cap, so a request that keeps failing waits at most 243 s before it gives up. bin/quak.ts loads the backup's session with them, so its refresh, ML data and downloads all use them; every other command keeps the default. What is retried and the backoff formula are unchanged. Model: opus-5-5
This commit was merged in pull request #174.
This commit is contained in:
@@ -12,6 +12,10 @@ import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
||||
import { init, toBase64 } from "../../src/crypto/index.js";
|
||||
import { Client, type ClientSnapshot } from "../../src/client.js";
|
||||
import { loadSession } from "../../src/cli-session.js";
|
||||
import {
|
||||
DEFAULT_RETRY_OPTIONS,
|
||||
UNATTENDED_RETRY_OPTIONS,
|
||||
} from "../../src/retry.js";
|
||||
|
||||
const validSnapshot = (): ClientSnapshot => {
|
||||
const kp = sodium.crypto_box_keypair();
|
||||
@@ -176,6 +180,20 @@ describe("loadSession", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("gives the restored client the retry options it is passed", () => {
|
||||
const path = join(dir, "retry.json");
|
||||
writeFileSync(path, JSON.stringify(validSnapshot()));
|
||||
const retryOptions = (client: Client | null) =>
|
||||
client!.getApiClient().getRetryOptions();
|
||||
|
||||
expect(
|
||||
retryOptions(
|
||||
loadSession(path, { retry: UNATTENDED_RETRY_OPTIONS }),
|
||||
),
|
||||
).toEqual(UNATTENDED_RETRY_OPTIONS);
|
||||
expect(retryOptions(loadSession(path))).toEqual(DEFAULT_RETRY_OPTIONS);
|
||||
});
|
||||
|
||||
it("says the file is corrupt when it is not JSON", () => {
|
||||
const path = join(dir, "truncated.json");
|
||||
writeFileSync(path, '{"email": "user@exa');
|
||||
|
||||
Reference in New Issue
Block a user