原来交上去 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:
1 parent
593a409fca
commit
64994b9499
7 files changed
+199
-105
No files matched your search
@@ -7,6 +7,7 @@ import { useUserStore } from "shared/store/user"
|
||||
import { ContestStatus } from "utils/constants"
|
||||
import { parseTime, secondsToDuration } from "utils/functions"
|
||||
import RankMini from "../components/RankMini.vue"
|
||||
import { useVisibleInterval } from "shared/composables/visibleInterval"
|
||||
|
||||
/**
|
||||
* 比赛页「题目」(设计稿「比赛重设计」B,用户选的):一页放下。
|
||||
@@ -24,12 +25,9 @@ const tone = useTone()
|
||||
const running = computed(() => contestStore.contestStatus === ContestStatus.underway)
|
||||
const ended = computed(() => contestStore.contestStatus === ContestStatus.finished)
|
||||
|
||||
const { pause, resume } = useIntervalFn(
|
||||
const { pause, resume } = useVisibleInterval(
|
||||
() => contestStore.loadScoreboard(props.contestID),
|
||||
10_000,
|
||||
{
|
||||
immediate: false,
|
||||
},
|
||||
)
|
||||
watch(
|
||||
() => [contestStore.canEnter, contestStore.contestStatus] as const,
|
||||
|
||||
Reference in new issue
Block a user