MCPcopy Create free account
hub / github.com/apache/httpd / is_dead

Method is_dead

test/pyhttpd/env.py:639–662  ·  view source on GitHub ↗
(self, url: str = None, timeout: timedelta = None)

Source from the content-addressed store, hash-verified

637 return False
638
639 def is_dead(self, url: str = None, timeout: timedelta = None):
640 if url is None:
641 url = self._http_base
642 if timeout is None:
643 timeout = timedelta(seconds=5)
644 try_until = datetime.now() + timeout
645 last_err = None
646 while datetime.now() < try_until:
647 # noinspection PyBroadException
648 try:
649 r = self.curl_get(url)
650 if r.exit_code != 0:
651 return True
652 time.sleep(.1)
653 except ConnectionRefusedError:
654 log.debug("connection refused")
655 return True
656 except:
657 if last_err != str(sys.exc_info()[0]):
658 last_err = str(sys.exc_info()[0])
659 log.debug("Unexpected error: %s", last_err)
660 time.sleep(.1)
661 log.debug(f"Server still responding after {timeout}")
662 return False
663
664 def _run_apachectl(self, cmd) -> ExecResult:
665 conf_file = 'stop.conf' if cmd == 'stop' else 'httpd.conf'

Callers 3

apache_stopMethod · 0.95
apache_graceful_stopMethod · 0.95
apache_failMethod · 0.95

Calls 1

curl_getMethod · 0.95

Tested by

no test coverage detected