mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-22 12:43:32 +09:00
fix(dashboard): keep retrying a log tail refused for load
The proxy answers a tail over its rate or concurrent-tail cap with a 4xx, and a reconnect can arrive before the previous tail's slot is freed. Treating that as final left Follow stopped for good, while the existing backoff already waits long enough for the cap to clear. Assisted-by: LLM Signed-off-by: ZverGuy <maximbel2003@gmail.com>
This commit is contained in:
1 parent
84ed3aaefd
commit
1b4ce7433e
2 files changed
+10
-1
No files matched your search
+8
@@ -67,6 +67,14 @@ describe("useLogTail", () => {
|
||||
expect(new URL(raw.mock.calls[1][0], "http://x").searchParams.get("since")).toBe(T3)
|
||||
})
|
||||
|
||||
it("retries a tail refused for load instead of stopping", async () => {
|
||||
const { wrapper } = setup(new Response("too many concurrent requests", { status: 422 }), ndjson(line(T1, "a")))
|
||||
|
||||
const { result } = renderHook(() => useLogTail("/root/", "*", 1, { retryDelayMs: 1 }), { wrapper })
|
||||
|
||||
await waitFor(() => expect(result.current.entries.map((e) => e._msg)).toEqual(["a"]))
|
||||
})
|
||||
|
||||
it("does not connect while disabled", () => {
|
||||
const { raw, wrapper } = setup()
|
||||
|
||||
|
||||
+2
-1
@@ -14,7 +14,8 @@ interface TailSnapshot {
|
||||
|
||||
const FLUSH_MS = 100
|
||||
const MAX_RETRY_MS = 30_000
|
||||
const FATAL: ReadonlySet<string> = new Set(["bad-request", "unauthorized", "forbidden", "not-available", "limit"])
|
||||
// A 422 or 429 on tail is load (rate or concurrent-tail caps), which backoff outlasts.
|
||||
const FATAL: ReadonlySet<string> = new Set(["bad-request", "unauthorized", "forbidden", "not-available"])
|
||||
|
||||
const sleep = (ms: number, signal: AbortSignal) =>
|
||||
new Promise<void>((resolve) => {
|
||||
|
||||
Reference in new issue
Block a user