Copilot commented on code in PR #15404:
URL: https://github.com/apache/iotdb/pull/15404#discussion_r2057778289
##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/task/subtask/PipeAbstractConnectorSubtask.java:
##########
@@ -240,4 +254,10 @@ protected synchronized void
clearReferenceCountAndReleaseLastExceptionEvent() {
lastExceptionEvent = null;
}
}
+
+ private void preScheduleLowPriorityTask(int maxRetries) {
+ while (highPriorityLockTaskCount.get() != 0 && maxRetries != 0) {
+ maxRetries--;
Review Comment:
The busy-wait loop in preScheduleLowPriorityTask could lead to high CPU
usage. Consider adding a Thread.yield() or a short sleep (e.g.,
Thread.sleep(1)) inside the loop to avoid potential CPU spinning.
```suggestion
maxRetries--;
try {
Thread.sleep(1); // Introduce a short delay to avoid CPU spinning
} catch (InterruptedException e) {
Thread.currentThread().interrupt(); // Restore the interrupted status
break; // Exit the loop if the thread is interrupted
}
```
--
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]