From d6c57871049aa206fd95b2a5ead1ac39029a1bf7 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Wed, 4 Sep 2024 20:09:56 +0200 Subject: [PATCH] Fix random announce interval calculation --- sbapp/sideband/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py index 84e03fc..e3d1490 100644 --- a/sbapp/sideband/core.py +++ b/sbapp/sideband/core.py @@ -208,7 +208,7 @@ class SidebandCore(): self.last_lxmf_announce = 0 self.last_if_change_announce = 0 self.interface_local_adding = False - self.next_auto_announce = time.time() + 60*(random.random()*(SidebandCore.AUTO_ANNOUNCE_RANDOM_MAX-SidebandCore.AUTO_ANNOUNCE_RANDOM_MIN)) + self.next_auto_announce = time.time() + 60*(random.random()*(SidebandCore.AUTO_ANNOUNCE_RANDOM_MAX-SidebandCore.AUTO_ANNOUNCE_RANDOM_MIN)+SidebandCore.AUTO_ANNOUNCE_RANDOM_MIN) try: if not os.path.isfile(self.config_path): @@ -2657,7 +2657,7 @@ class SidebandCore(): if self.is_standalone or self.is_service: self.lxmf_destination.announce(attached_interface=attached_interface) self.last_lxmf_announce = time.time() - self.next_auto_announce = time.time() + 60*(random.random()*(SidebandCore.AUTO_ANNOUNCE_RANDOM_MAX-SidebandCore.AUTO_ANNOUNCE_RANDOM_MIN)) + self.next_auto_announce = time.time() + 60*(random.random()*(SidebandCore.AUTO_ANNOUNCE_RANDOM_MAX-SidebandCore.AUTO_ANNOUNCE_RANDOM_MIN)+SidebandCore.AUTO_ANNOUNCE_RANDOM_MIN) RNS.log("Next auto announce in "+RNS.prettytime(self.next_auto_announce-time.time()), RNS.LOG_DEBUG) self.setstate("wants.announce", False) else: