评审 P1 修正一批

设置:显式主题补 color-scheme,滚动条和 select 弹层这些 UA 部件不看
变量。连接:断开失败的提示与轮询取数分成两条通道,不再被下一秒的轮询
成功抹掉;排序加 id 决胜,内核快照的遍历序无序,空闲连接下载量普遍
相同,没有决胜键行会在断开按钮下面跳。仪表盘与请求:一条流断了连带
收掉同组连接;断流不等于内核没了(配置重载掐断流而 online 从未翻转),
5 秒自动重连。规则:正则类规则(DOMAIN-REGEX 等三种)按内核的
payloadCanContainComma 语义拆分与禁入结构化编辑,顶层逗号不再把正则
截一半当目标;findRuleIssues 注释里对内核校验的错误断言改正。
This commit is contained in:
2026-08-11 21:14:03 +08:00
parent bd087aabea
commit 35eb463633
8 changed files with 102 additions and 18 deletions
+21 -2
View File
@@ -77,9 +77,23 @@ function flush() {
void scrollToBottom()
}
/**
* 断流不等于内核没了:配置重载会掐断流,而内核几秒内就回来、online 从未翻转。
* 断了 5 秒后自动重连,失败会再次走到这里形成重试节奏;真离线时交给下面等
* online 翻转的 watch。
*/
let retryTimer = 0
function scheduleRetry() {
window.clearTimeout(retryTimer)
retryTimer = window.setTimeout(() => {
if (kernel.value.online) void pump()
}, 5000)
}
async function pump() {
// 切换级别或内核恢复在线都从这里重连。旧流先停,不然两条流一起往缓冲里倒
aborter?.abort()
window.clearTimeout(retryTimer)
const controller = new AbortController()
aborter = controller
failure.value = ''
@@ -88,10 +102,14 @@ async function pump() {
for await (const line of streamLogs(level.value, controller.signal)) {
pending.push({ ...line, id: nextId++, time: clock(new Date()) })
}
if (!controller.signal.aborted) ended.value = true
if (!controller.signal.aborted) {
ended.value = true
scheduleRetry()
}
} catch (error) {
if (controller.signal.aborted) return
failure.value = error instanceof Error ? error.message : String(error)
scheduleRetry()
}
}
@@ -116,6 +134,7 @@ watch(level, () => {
onBeforeUnmount(() => {
aborter?.abort()
window.clearInterval(timer)
window.clearTimeout(retryTimer)
})
const visible = computed(() => {
@@ -164,7 +183,7 @@ const visible = computed(() => {
</template>
</div>
<p v-if="ended && !failure" class="notice">日志流已中断。切换级别可重新连接。</p>
<p v-if="ended && !failure" class="notice">日志流已中断,将自动重连。</p>
</div>
</template>