[server] avoid race-condition in timer events stable
authorJulien Cristau <julien.cristau@logilab.fr>
Wed, 04 Dec 2013 19:11:04 +0100
branchstable
changeset 9354 523273da6738
parent 9353 aa8be290374e
child 9355 19ab31ea6ffb
[server] avoid race-condition in timer events With a granularity of one second, there's a good chance calling localtime twice will return the same value. We should consider the event ready immediately if that happens, not wait one second.
server/server.py
--- a/server/server.py	Wed Dec 04 19:14:43 2013 +0100
+++ b/server/server.py	Wed Dec 04 19:11:04 2013 +0100
@@ -48,7 +48,7 @@
     def is_ready(self):
         """return  true if the event is ready to be fired"""
         now = self.timefunc()
-        if self.absolute < now:
+        if self.absolute <= now:
             return True
         return False