28def scheduler_function(start_after_from: int, start_after_to: int, every_from: int, every_to: int, callback: Callable):
29 """Run the checker periodically. The function never returns.
32 * start_after_from and start_after_to: when to call "callback" for the first on the Redis instance
33 * every_from and every_to: after the first call, how often to call "callback"
36 * to call this function is multiple workers
37 * to kill workers at any time as long there is one at least one worker
39 scheduler_now_script = SCHEDULER_LUA.open().read()
45 script = lua_script_storage(get_redis_client(), scheduler_now_script)
46 call_now, wait_time = script(args=[start_after_from, start_after_to, every_from, every_to])
54 logger.exception(
"Error calling the embedded checker")
56 logger.info(
"Next call to the checker in %s seconds", wait_time)