Skip to content

Commit

Permalink
New: Global Latency Test
Browse files Browse the repository at this point in the history
  • Loading branch information
jason5ng32 committed Jan 25, 2024
1 parent 700b817 commit 10baaa2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion public/res/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,7 @@ new Vue({
startPingCheck() {
// 清空上一次结果
this.pingResults = [];
let tryCount = 0;
// 子函数:发起 ping 请求
const sendPingRequest = async () => {
this.pingCheckStatus = "running";
Expand Down Expand Up @@ -1259,8 +1260,9 @@ new Vue({
const data = await response.json();
this.processPingResults(data);

if (data.status === "in-progress") {
if (data.status === "in-progress" && tryCount < 4) {
setTimeout(() => fetchPingResults(id), 1000);
tryCount++;
} else {
this.pingCheckStatus = "finished";
}
Expand Down

0 comments on commit 10baaa2

Please sign in to comment.