def check_aggregator(self):
'''
If the aggregator is live, but isn't getting events, log a diagnostic
warning.
This function is sometimes called using deferLater, so any exceptions
will be handled by errorCallback.
'''
if (self.aggregator is not None and not self.is_aggregator_pending and
self.expected_aggregator_start_time is not None and
self.expected_aggregator_start_time < time()):
aggregator_live_time = time() - self.expected_aggregator_start_time
flag_message = "Is your relay in the Tor consensus?"
flag_list = self.get_flag_list()
if len(flag_list) > 0:
flag_message = "Consensus flags: {}".format(" ".join(flag_list))
if self.are_dc_events_expected():
log_fn = logging.warning
else:
log_fn = logging.info
if ((self.aggregator.protocol is None or
self.aggregator.protocol.state != "processing") and
aggregator_live_time > EXPECTED_CONTROL_ESTABLISH_MAX):
logging.warning("Aggregator has been running {}, but is not connected to the control port. Is your control port working?"
.format(format_elapsed_time_since(
self.expected_aggregator_start_time,
'since')))
elif (self.aggregator.last_event_time is None and
aggregator_live_time > EXPECTED_EVENT_INTERVAL_MAX):
log_fn("Aggregator has been running {}, but has not seen a tor event. {}"
.format(format_elapsed_time_since(
self.expected_aggregator_start_time,
'since'),
flag_message))
elif (self.aggregator.last_event_time is not None and
self.aggregator.last_event_time < time() - EXPECTED_EVENT_INTERVAL_MAX):
log_fn("Aggregator has not received any events recently, {}. {}"
.format(format_last_event_time_since(
self.aggregator.last_event_time),
flag_message))
评论列表
文章目录