mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-07 01:47:47 +08:00
- 将 record_pending 调用移至执行开始前(sync/stream 两路),确保请求在执行前即有 pending 记录 - stream_pump 在收到第一个数据块前优先 yield 遥测帧,保证 ttfb 早于 data 帧到达 - stream execution 增加 should_refresh_stream_usage_telemetry,在遥测帧携带新 ttfb/elapsed 时及时更新 record_stream_started - access_log 对高频轮询路径(usage/active、usage/records 等)降级为 TRACE 日志,减少日志噪音 - 前端新增 reconcileActiveRequestDiscovery 工具函数及 discoverActiveRequests 逻辑,活跃请求发现与全局自动刷新解耦,空闲时降频为 5 秒扫描 - RequestDetailDrawer 调整:进行中请求不再自动开启轮询,由用户手动触发;刷新按钮 title 动态适配状态
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
export interface ActiveRequestDiscoverySnapshot {
|
|
activeRequestIds: Iterable<string>
|
|
knownRecordIds: Iterable<string>
|
|
discoveredActiveRequestIds: Iterable<string>
|
|
}
|
|
|
|
export interface ActiveRequestDiscoveryResult {
|
|
retainedDiscoveredActiveRequestIds: string[]
|
|
unseenActiveRequestIds: string[]
|
|
}
|
|
|
|
export function reconcileActiveRequestDiscovery(
|
|
snapshot: ActiveRequestDiscoverySnapshot
|
|
): ActiveRequestDiscoveryResult {
|
|
const knownRecordIds = new Set(snapshot.knownRecordIds)
|
|
const activeRequestIds: string[] = []
|
|
const activeRequestIdSet = new Set<string>()
|
|
|
|
for (const id of snapshot.activeRequestIds) {
|
|
if (!id || activeRequestIdSet.has(id)) continue
|
|
activeRequestIdSet.add(id)
|
|
activeRequestIds.push(id)
|
|
}
|
|
|
|
const retainedDiscoveredActiveRequestIds: string[] = []
|
|
const retainedDiscoveredSet = new Set<string>()
|
|
|
|
for (const id of snapshot.discoveredActiveRequestIds) {
|
|
if (!id || retainedDiscoveredSet.has(id)) continue
|
|
if (knownRecordIds.has(id) || !activeRequestIdSet.has(id)) continue
|
|
retainedDiscoveredSet.add(id)
|
|
retainedDiscoveredActiveRequestIds.push(id)
|
|
}
|
|
|
|
const unseenActiveRequestIds = activeRequestIds.filter(
|
|
id => !knownRecordIds.has(id) && !retainedDiscoveredSet.has(id)
|
|
)
|
|
|
|
return {
|
|
retainedDiscoveredActiveRequestIds,
|
|
unseenActiveRequestIds
|
|
}
|
|
}
|