From 63494665a34edfae33c590a8951907f520d841d1 Mon Sep 17 00:00:00 2001 From: xiaoleizi2016 Date: Fri, 29 Dec 2023 12:04:54 +0800 Subject: [PATCH] fix(core): task restore interrupt problem on restart server (#2401) * Update StandardTaskScheduler.java --- .../org/apache/hugegraph/task/StandardTaskScheduler.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/StandardTaskScheduler.java b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/StandardTaskScheduler.java index 55aed5baf1..1c5e462d9c 100644 --- a/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/StandardTaskScheduler.java +++ b/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/StandardTaskScheduler.java @@ -138,6 +138,7 @@ private TaskTransaction tx() { @Override public void restoreTasks() { Id selfServer = this.serverManager().selfNodeId(); + List> taskList = new ArrayList<>(); // Restore 'RESTORING', 'RUNNING' and 'QUEUED' tasks in order. for (TaskStatus status : TaskStatus.PENDING_STATUSES) { String page = this.supportsPaging() ? PageInfo.PAGE_NONE : null; @@ -147,7 +148,7 @@ public void restoreTasks() { iter.hasNext();) { HugeTask task = iter.next(); if (selfServer.equals(task.server())) { - this.restore(task); + taskList.add(task); } } if (page != null) { @@ -155,6 +156,10 @@ public void restoreTasks() { } } while (page != null); } + for (HugeTask task : taskList){ + LOG.info("restore task {}", task); + this.restore(task); + } } private Future restore(HugeTask task) {