[X2Go-Commits] [x2gobroker] 02/02: x2gobroker/loadchecker.py: Avoid rare cases where at the end of a load checking cycle a negative sleep time would have been calculated. (Fixes: #1315). Thanks to Walid Moghrabi for catching this.

git-admin at x2go.org git-admin at x2go.org
Thu Sep 13 15:50:33 CEST 2018


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2gobroker.

commit 533a37bc1650b1caf48e03a101df18e2c89b6f79
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Thu Sep 13 15:49:44 2018 +0200

    x2gobroker/loadchecker.py: Avoid rare cases where at the end of a load checking cycle a negative sleep time would have been calculated. (Fixes: #1315). Thanks to Walid Moghrabi for catching this.
---
 debian/changelog          | 3 +++
 x2gobroker/loadchecker.py | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index cbe2446..6c8f0df 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -80,6 +80,9 @@ x2gobroker (0.0.4.0-0x2go1) UNRELEASED; urgency=medium
     - x2gobroker/loadchecker.py: Don't re-read the x2gobroker.conf during
       each cycle of the load checking loop. Rather read it on service startup
       and require a service restart when x2gobroker.conf has been changed.
+    - x2gobroker/loadchecker.py: Avoid rare cases where at the end of a load
+      checking cycle a negative sleep time would have been calculated.
+      (Fixes: #1315). Thanks to Walid Moghrabi for catching this.
   * debian/*:
     + Trigger Makefile's install target and install those files. Drop debhelper
       from-source-installation magic.
diff --git a/x2gobroker/loadchecker.py b/x2gobroker/loadchecker.py
index bc01bf3..b672e80 100644
--- a/x2gobroker/loadchecker.py
+++ b/x2gobroker/loadchecker.py
@@ -316,8 +316,8 @@ class LoadChecker(threading.Thread):
                 time.sleep(self.load_checker_intervals)
             if num_queries > 0:
                 if time_to_sleep > 0:
-                    if self.logger: self.logger.debug('LoadChecker.loadchecker(): performed {num} queries (failures: {num_failures}), sleeping for {secs}secs before starting next query cycle'.format(num=num_queries, num_failures=num_failed_queries, secs=self.load_checker_intervals - time_to_sleep * num_queries))
-                    time.sleep(self.load_checker_intervals - time_to_sleep * num_queries)
+                    if self.logger: self.logger.debug('LoadChecker.loadchecker(): performed {num} queries (failures: {num_failures}), sleeping for {secs}secs before starting next query cycle'.format(num=num_queries, num_failures=num_failed_queries, secs=time_to_sleep))
+                    time.sleep(time_to_sleep)
                 time_to_sleep = self.load_checker_intervals / (num_queries +1)
             else:
                 if self.logger: self.logger.warning('LoadChecker.loadchecker(): performed {num} queries (failures: {num_failures}) in this cycle, if this message keeps repeating itself, consider disabling the X2Go Broker Load Checker daemon'.format(num=num_queries, num_failures=num_failed_queries, secs=self.load_checker_intervals - time_to_sleep * num_queries))

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git


More information about the x2go-commits mailing list