diff --git a/zulip/zulip/__init__.py b/zulip/zulip/__init__.py index a63fc50e7..21c862fad 100644 --- a/zulip/zulip/__init__.py +++ b/zulip/zulip/__init__.py @@ -95,7 +95,7 @@ def fail(self): # Exponential growth with ratio sqrt(2); compute random delay # between x and 2x where x is growing exponentially delay_scale = int(2 ** (self.number_of_retries / 2.0 - 1)) + 1 - delay = min(delay_scale + random.randint(1, delay_scale), delay_cap) + delay = min(delay_scale + random.randint(1, delay_scale), self.delay_cap) message = "Sleeping for %ss [max %s] before retrying." % (delay, delay_scale * 2) try: logger.warning(message) diff --git a/zulip_bots/zulip_bots/run.py b/zulip_bots/zulip_bots/run.py index 0634bf8fd..9e9b1db93 100755 --- a/zulip_bots/zulip_bots/run.py +++ b/zulip_bots/zulip_bots/run.py @@ -127,9 +127,14 @@ def main() -> None: lib_module = finder.import_module_by_name(args.bot) if lib_module: bot_name = lib_module.__name__ - if args.provision: - print("ERROR: Could not load bot's module for '{}'. Exiting now.") - sys.exit(1) + + # Removed: Not needed as lib_module would have + # been imported during runtime if control + # flow reaches here. Adding any other provision + # check after this would be unnecessary as + # provision_bots require bot_path which + # could not be found, hence result is None + # and control is here. if lib_module is None: print("ERROR: Could not load bot module. Exiting now.")