Copilot commented on code in PR #2937:
URL: https://github.com/apache/hugegraph/pull/2937#discussion_r3333317810
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/TaskManager.java:
##########
@@ -102,11 +97,6 @@ private TaskManager(int pool) {
// For a schedule task to run, just one thread is ok
this.schedulerExecutor = ExecutorUtil.newPausableScheduledThreadPool(
1, TASK_SCHEDULER);
- // Start after 10x period time waiting for HugeGraphServer startup
-
this.schedulerExecutor.scheduleWithFixedDelay(this::scheduleOrExecuteJob,
- 10 * SCHEDULE_PERIOD,
- SCHEDULE_PERIOD,
- TimeUnit.MILLISECONDS);
}
Review Comment:
TaskManager no longer schedules any periodic work on schedulerExecutor (the
scheduleWithFixedDelay() call was removed), but the schedulerExecutor thread
pool is still created and kept alive until shutdown. This leaves an idle thread
around for no functional benefit and adds extra shutdown/tx-close complexity;
consider removing schedulerExecutor (and its related close/shutdown code) if it
is no longer part of the scheduling architecture.
##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/task/DistributedTaskScheduler.java:
##########
@@ -316,14 +355,18 @@ protected <V> HugeTask<V> deleteFromDB(Id id) {
@Override
public <V> HugeTask<V> delete(Id id, boolean force) {
- if (!force) {
- // Change status to DELETING, perform the deletion operation
through automatic
- // scheduling.
+ HugeTask<?> task = this.taskWithoutResult(id);
+
+ if (!force && !task.completed()) {
Review Comment:
DistributedTaskScheduler.delete() returns null for existing but incomplete
tasks (force=false). This makes TaskAPI.delete() throw "There is no taskā¦" even
though the task exists, because TaskAPI only checks for null. Consider
returning the task after marking it DELETING (or throw a clear exception) to
avoid falsely reporting missing tasks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]