def Run(self):
    """Event loop."""
    if data_store.RelationalDBEnabled():
      data_store.REL_DB.RegisterMessageHandler(
          self._ProcessMessageHandlerRequests,
          self.well_known_flow_lease_time,
          limit=100)
      data_store.REL_DB.RegisterFlowProcessingHandler(self.ProcessFlow)

    try:
      while 1:
        processed = self.RunOnce()
        if processed == 0:
          if time.time() - self.last_active > self.SHORT_POLL_TIME:
            interval = self.POLLING_INTERVAL
          else:
            interval = self.SHORT_POLLING_INTERVAL

          time.sleep(interval)
        else:
          self.last_active = time.time()
    except KeyboardInterrupt:
      logging.info("Caught interrupt, exiting.")
      self.thread_pool.Join()
def Run ( self ) : if data_store . RelationalDBEnabled ( ) : data_store . REL_DB . RegisterMessageHandler ( self . _ProcessMessageHandlerRequests , self . well_known_flow_lease_time , limit = 100 ) data_store . REL_DB . RegisterFlowProcessingHandler ( self . ProcessFlow ) try : while 1 : processed = self . RunOnce ( ) if processed == 0 : if time . time ( ) - self . last_active > self . SHORT_POLL_TIME : interval = self . POLLING_INTERVAL else : interval = self . SHORT_POLLING_INTERVAL time . sleep ( interval ) else : self . last_active = time . time ( ) except KeyboardInterrupt : logging . info ( "Caught interrupt, exiting." ) self . thread_pool . Join ( )
Event loop.