Commit 80edb50d authored by chechunchi's avatar chechunchi

optimize setTimeout

parent 012d2682
Pipeline #21560 passed with stages
in 15 minutes and 40 seconds
...@@ -55,7 +55,13 @@ const ActiveList = [ ...@@ -55,7 +55,13 @@ const ActiveList = [
"select_yes_no", "select_yes_no",
]; ];
const TIME_GAP = 200;
export default function handleGameMsg(pb: ygopro.YgoStocMsg) { export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
// 防止MSG更新太频繁,做下控频
//
// TODO: 细化需要控频的MSG
setTimeout(() => {
const msg = pb.stoc_game_msg; const msg = pb.stoc_game_msg;
if (ActiveList.includes(msg.gameMsg)) { if (ActiveList.includes(msg.gameMsg)) {
...@@ -267,4 +273,5 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) { ...@@ -267,4 +273,5 @@ export default function handleGameMsg(pb: ygopro.YgoStocMsg) {
break; break;
} }
} }
}, TIME_GAP);
} }
import { sendTimeConfirm, ygopro } from "@/api"; import { sendTimeConfirm, ygopro } from "@/api";
import { matStore } from "@/stores"; import { matStore } from "@/stores";
const TIME_GAP = 1500; const TIME_GAP = 200; // TODO: use config
export default function handleTimeLimit(timeLimit: ygopro.StocTimeLimit) { export default function handleTimeLimit(timeLimit: ygopro.StocTimeLimit) {
setTimeout(() => { setTimeout(() => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment