perf(判题结果): 全班一起交、判题排队时不再每人每 2 秒问一次结果
Deploy / deploy (push) Canceled after 0s

原来交上去 5 秒没结果就每 2 秒(流程图 3 秒)拉一次,分不清 WebSocket 断了还是队列长:
50 人一起交、队列排一分钟时每秒二十几个请求,全在和判题抢那两个核。

- 收到这一条的任何推送(服务端订阅时就回一帧当前状态)就认定 WebSocket 是通的,
  轮询退到 20 秒一次,只防推送丢失;连接断了才回快档,2 秒起按 1.5 倍退到 10 秒
- 拉失败不再永久停掉(掉线那几秒拉失败是常事),连着失败 5 次才放弃
- 页面在后台时不拉;比赛题目页、榜单、班级页的定时刷新也一样,切回来立刻补一次
- 代码判题和流程图评分共用 shared/composables/fallbackPoll.ts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-16 14:37:08 +08:00
1 parent 593a409fca
commit 64994b9499
7 files changed
+199 -105

No files matched your search

+2 -1
View File
@@ -11,6 +11,7 @@ import { useLeaveStudents } from "shared/composables/leaveStudents"
import { ContestStatus, LANGUAGE_FORMAT_VALUE } from "utils/constants"
import { parseTime, secondsToDuration } from "utils/functions"
import type { Submission } from "utils/types"
import { useVisibleInterval } from "shared/composables/visibleInterval"
/**
* 老师的「全班情况」,考完叫「成绩」(设计稿「比赛重设计」老师两块)。学生看不到这一页。
@@ -43,7 +44,7 @@ async function load() {
const running = computed(() => contestStore.contestStatus === ContestStatus.underway)
const ended = computed(() => contestStore.contestStatus === ContestStatus.finished)
const { pause, resume } = useIntervalFn(load, 15_000, { immediate: false })
const { pause, resume } = useVisibleInterval(load, 15_000)
watch(
() => [contestStore.canEnter, running.value] as const,
([enter, run]) => {