Skip to content

Commit a110112

Browse files
committed
fix(server): fix some issues of the distributed scheduler
1 parent 5ffd20b commit a110112

1 file changed

Lines changed: 9 additions & 16 deletions

File tree

  • hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task

hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/HugeTask.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -740,26 +740,19 @@ private void checkPropertySize(int propertyLength, String propertyName) {
740740

741741
public void syncWait() {
742742
// This method is just called by tests
743-
/*
744-
* For ephemeral tasks (negative ID), directly wait on the Future.
745-
* Ephemeral tasks are not saved to DB, so we can't query them by ID.
746-
* Since HugeTask extends FutureTask, we can directly wait for completion.
747-
*/
748-
if (this.id().asLong() < 0) {
749-
try {
750-
this.get();
751-
} catch (Exception e) {
752-
throw new HugeException("Failed to wait for task '%s' completed",
753-
e, this.id);
754-
}
755-
return;
756-
}
757-
758-
// For normal tasks, wait through scheduler
759743
HugeTask<?> task = null;
760744
try {
761745
task = this.scheduler().waitUntilTaskCompleted(this.id());
762746
} catch (Throwable e) {
747+
if (this.callable() instanceof EphemeralJob &&
748+
e.getClass() == NotFoundException.class &&
749+
e.getMessage().contains("Can't find task with id")) {
750+
/*
751+
* The task with EphemeralJob won't saved in backends and
752+
* will be removed from memory when completed
753+
*/
754+
return;
755+
}
763756
throw new HugeException("Failed to wait for task '%s' completed",
764757
e, this.id);
765758
}

0 commit comments

Comments
 (0)