Skip to content

Commit 94fbbde

Browse files
committed
chore: 修复面板运行时间
1 parent 1be724f commit 94fbbde

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

assets/js/index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1378,13 +1378,23 @@ async function load() {
13781378
object.finish = false;
13791379
clearInterval($dashboard_locals.info_runtime_task)
13801380
$dashboard_locals.info_runtime_task = Tools.runTask(setInterval, () => {
1381+
if (object.start_time == null) {
1382+
$dashboard_locals.runtime.time = Tools.formatTime(null);
1383+
return;
1384+
}
13811385
const runtime = object.current_time - object.start_time - object.diff / 1000.0 + (+new Date() - object.resp_timestamp) / 1000.0;
13821386
$dashboard_locals.runtime.time = Tools.formatTime(runtime);
13831387
}, 1000)
13841388
}
13851389
})
13861390
$dashboard_locals.info_task = Tools.runTask(setInterval, async () => {
1387-
var resp = await $channel.send("runtime", +new Date())
1391+
var resp = null;
1392+
try {
1393+
resp = await $channel.send("runtime", +new Date())
1394+
} catch (e) {
1395+
$dashboard_locals.info_runtime.start_time = null;
1396+
return
1397+
}
13881398
var start_time = resp.timestamp - resp.runtime;
13891399
// time fixed
13901400
for (const [key, value] of Object.entries({

0 commit comments

Comments
 (0)