Aitozi commented on code in PR #19886:
URL: https://github.com/apache/flink/pull/19886#discussion_r890717053


##########
flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/DeclarativeSlotManager.java:
##########
@@ -407,13 +420,39 @@ public void freeSlot(SlotID slotId, AllocationID 
allocationId) {
         LOG.debug("Freeing slot {}.", slotId);
 
         slotTracker.notifyFree(slotId);
-        checkResourceRequirements();
+        checkResourceRequirementsWithDelay();
     }
 
     // 
---------------------------------------------------------------------------------------------
     // Requirement matching
     // 
---------------------------------------------------------------------------------------------
 
+    /**
+     * Depending on the implementation of {@link ResourceAllocationStrategy}, 
checking resource
+     * requirements and potentially making a re-allocation can be heavy. In 
order to cover more
+     * changes with each check, thus reduce the frequency of unnecessary 
re-allocations, the checks
+     * are performed with a slight delay.
+     */
+    private void checkResourceRequirementsWithDelay() {
+        if (requirementsCheckDelay.toMillis() <= 0) {

Review Comment:
   Yes, will fix it



-- 
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]

Reply via email to