From 878bb6f89285873ee48c565ce545266cc3cccb11 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Tue, 24 Jan 2023 08:45:29 +0100 Subject: [PATCH] do not throw ZeroDivisonError when pollinterval is 0 fast_interval might be 0, indicating to poll as fast as possible - this should not throw a zero division error Change-Id: I26e18f5a656c943b906c6ffff65361e1fcf16d50 --- frappy/modules.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frappy/modules.py b/frappy/modules.py index 37f4dcc8..7c02de71 100644 --- a/frappy/modules.py +++ b/frappy/modules.py @@ -683,7 +683,10 @@ class Module(HasAccessibles): for mobj in modules: pinfo = mobj.pollInfo if now > pinfo.last_main + pinfo.interval: - pinfo.last_main = (now // pinfo.interval) * pinfo.interval + try: + pinfo.last_main = (now // pinfo.interval) * pinfo.interval + except ZeroDivisionError: + pinfo.last_main = now mobj.callPollFunc(mobj.doPoll) now = time.time() # find ONE due slow poll and call it