def _run_trigger_loop(self) -> None: """ The main-thread trigger loop. This runs synchronously and handles all database reads/writes. """ while not self.runner.stop: # Clean out unused triggers Trigger.clean_unused() # Load/delete triggers self.load_triggers() # Handle events self.handle_events() # Handle failed triggers self.handle_failed_triggers() # Idle sleep time.sleep(1)
def _run_trigger_loop(self) -> None: """ The main-thread trigger loop. This runs synchronously and handles all database reads/writes. """ while not self.runner.stop: # Clean out unused triggers Trigger.clean_unused() # Load/delete triggers self.load_triggers() # Handle events self.handle_events() # Handle failed triggers self.handle_failed_triggers() # Handle heartbeat self.heartbeat(only_if_necessary=True) # Collect stats self.emit_metrics() # Idle sleep time.sleep(1)