|
@@ -189,18 +189,19 @@ async function updateTask() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// 5秒更新一次tasks
|
|
|
-addInterval(() => {
|
|
|
- // console.log("get task", store.tasks);
|
|
|
+function nextTask() {
|
|
|
// 正在预绘制中,则不要再取任务,以免拖慢当前任务的绘制
|
|
|
if (!preDrawing) {
|
|
|
if (store.tasks.length < (store.setting.prefetchCount ?? 3)) {
|
|
|
// 回看打开时,停止取任务
|
|
|
if (!store.historyOpen)
|
|
|
- updateTask().catch((e) => console.log("定时获取任务出错", e));
|
|
|
+ return updateTask().catch((e) => console.log("定时获取任务出错", e));
|
|
|
}
|
|
|
}
|
|
|
-}, 5 * 1000);
|
|
|
+}
|
|
|
+
|
|
|
+// 5秒更新一次tasks
|
|
|
+addInterval(nextTask, 5 * 1000);
|
|
|
|
|
|
// 不需要
|
|
|
// addInterval(() => {
|
|
@@ -212,7 +213,7 @@ onMounted(async () => {
|
|
|
await updateSetting();
|
|
|
await updateStatus();
|
|
|
await updateGroups();
|
|
|
- await updateTask();
|
|
|
+ await nextTask();
|
|
|
});
|
|
|
|
|
|
const __debounceUpdate = debounce(() => {
|
|
@@ -432,6 +433,8 @@ const saveTaskToServer = async () => {
|
|
|
if (!res) return;
|
|
|
// 故意不在此处同步等待,因为不必等待
|
|
|
updateStatus().catch((e) => console.log("保存任务后获取status出错", e));
|
|
|
+ // 获取下一个任务
|
|
|
+ void nextTask();
|
|
|
if (res.data.success && store.currentTask) {
|
|
|
void message.success({ content: "保存成功", key: mkey, duration: 2 });
|
|
|
if (!store.historyOpen) {
|