fix(web): 降低 dashboard SSE 暫時重連噪音
This commit is contained in:
@@ -287,11 +287,10 @@ export const useDashboardStore = create<DashboardState>()(
|
|||||||
|
|
||||||
// Error handling with exponential backoff
|
// Error handling with exponential backoff
|
||||||
eventSource.onerror = (e) => {
|
eventSource.onerror = (e) => {
|
||||||
console.error('[SSE] Error:', e)
|
|
||||||
|
|
||||||
const attempts = get().reconnectAttempts
|
const attempts = get().reconnectAttempts
|
||||||
|
|
||||||
if (attempts >= MAX_RECONNECT_ATTEMPTS) {
|
if (attempts >= MAX_RECONNECT_ATTEMPTS) {
|
||||||
|
console.error('[SSE] Max reconnect attempts reached:', e)
|
||||||
set({
|
set({
|
||||||
connectionStatus: 'error',
|
connectionStatus: 'error',
|
||||||
error: 'Max reconnection attempts reached',
|
error: 'Max reconnection attempts reached',
|
||||||
@@ -312,7 +311,7 @@ export const useDashboardStore = create<DashboardState>()(
|
|||||||
MAX_RECONNECT_DELAY
|
MAX_RECONNECT_DELAY
|
||||||
)
|
)
|
||||||
|
|
||||||
console.log(`[SSE] Reconnecting in ${delay}ms (attempt ${attempts + 1})`)
|
console.warn(`[SSE] Reconnecting in ${delay}ms (attempt ${attempts + 1})`, e)
|
||||||
|
|
||||||
if (reconnectTimeout) clearTimeout(reconnectTimeout)
|
if (reconnectTimeout) clearTimeout(reconnectTimeout)
|
||||||
reconnectTimeout = setTimeout(() => {
|
reconnectTimeout = setTimeout(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user