nvazquez commented on code in PR #7977:
URL: https://github.com/apache/cloudstack/pull/7977#discussion_r1353984495


##########
server/src/main/java/com/cloud/resourcelimit/ResourceLimitManagerImpl.java:
##########
@@ -1171,6 +1178,27 @@ public ResourceCountCheckTask() {
 
         @Override
         protected void runInContext() {
+            GlobalLock lock = GlobalLock.getInternLock("ResourceCheckTask");
+            try {
+                if (lock.lock(30)) {
+                    ManagementServerHostVO msHost = 
managementServerHostDao.findOneByLongestRuntime();
+                    if (msHost == null || (msHost.getMsid() != 
ManagementServerNode.getManagementServerId())) {
+                        s_logger.debug("Skipping the resource counters 
recalculation task on this management server");
+                        lock.unlock();
+                        return;

Review Comment:
   No, the releaseRef will be executed after that as its part of the finally 
block



-- 
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: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to