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


##########
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();

Review Comment:
   Thanks, fixed



##########
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();

Review Comment:
   Thanks, fixed



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