more code
This commit is contained in:
1 parent
f24fd63e9a
commit
ee72257c64
29 files changed
+5636
-440
No files matched your search
+11
-2
@@ -417,6 +417,8 @@ export function streamLogs(handlers: LogStreamHandlers): () => void {
|
||||
let backoff = RECONNECT_MIN_MS
|
||||
let timer: ReturnType<typeof setTimeout> | undefined
|
||||
let attempt = 0
|
||||
// One error report per outage streak: a flaky link must not toast every 15s.
|
||||
let reported = false
|
||||
|
||||
const open = (): void => {
|
||||
if (stopped) return
|
||||
@@ -447,11 +449,15 @@ export function streamLogs(handlers: LogStreamHandlers): () => void {
|
||||
const message = res.ok
|
||||
? 'the live log stream is not supported by this browser'
|
||||
: `the live log stream failed with HTTP ${res.status}`
|
||||
handlers.onError(message)
|
||||
if (!reported) {
|
||||
reported = true
|
||||
handlers.onError(message)
|
||||
}
|
||||
schedule()
|
||||
return
|
||||
}
|
||||
|
||||
reported = false
|
||||
attempt = 0
|
||||
backoff = RECONNECT_MIN_MS
|
||||
handlers.onOpen()
|
||||
@@ -463,7 +469,10 @@ export function streamLogs(handlers: LogStreamHandlers): () => void {
|
||||
if (stopped) return
|
||||
if (controller.signal.aborted) return
|
||||
const message = err instanceof Error ? err.message : 'the live log stream dropped'
|
||||
handlers.onError(message)
|
||||
if (!reported) {
|
||||
reported = true
|
||||
handlers.onError(message)
|
||||
}
|
||||
schedule()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user