UPDATE: 异步导出检测数据逻辑。

This commit is contained in:
贾同学
2025-09-19 16:18:10 +08:00
parent 3e7509cd44
commit a9156f0954
4 changed files with 150 additions and 15 deletions

View File

@@ -211,13 +211,19 @@ class RequestHttp {
const eventSource = new EventSourcePolyfill(requestUrl, {
headers: {
Authorization: 'Bearer ' + userStore.accessToken
}
},
// 增加超时时间到120秒
heartbeatTimeout: 120000
})
// 设置默认的Authorization头部
eventSource.addEventListener('open', function () {
console.log('SSE连接已建立')
})
// 添加错误处理
eventSource.addEventListener('error', function (err) {
console.error('SSE连接错误:', err)
})
return eventSource
}