def check_loop(self, service):
logger.info("<STR_LIT>", service.name)<EOL>def handle_checks_result(f):<EOL><INDENT>try:<EOL><INDENT>came_up, went_down = f.result()<EOL><DEDENT>except Exception:<EOL><INDENT>logger.exception("<STR_LIT>", service.name)<EOL>return<EOL><DEDENT>if not came_up and not went_down:<EOL><INDENT>return<EOL><DEDENT>discovery = self.configurables[Discovery][service.discovery]<EOL>for port in came_up:<EOL><INDENT>logger.debug("<STR_LIT>", service.name, port)<EOL>discovery.report_up(service, port)<EOL><DEDENT>for port in went_down:<EOL><INDENT>logger.debug("<STR_LIT>", service.name, port)<EOL>discovery.report_down(service, port)<EOL><DEDENT><DEDENT>while (<EOL>service in self.configurables[Service].values() and<EOL>not self.shutdown.is_set()<EOL>):<EOL><INDENT>self.work_pool.submit(<EOL>self.run_checks, service<EOL>).add_done_callback(<EOL>handle_checks_result<EOL>)<EOL>logger.debug("<STR_LIT>", service.check_interval)<EOL>wait_on_event(self.shutdown, timeout=service.check_interval)<EOL><DEDENT>
While the reporter is not shutting down and the service being checked
is present in the reporter's configuration, this method will launch a
job to run all of the service's checks and then pause for the
configured interval.