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

Method is_live

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

Source from the content-addressed store, hash-verified

612 fd.write('\n')
613
614 def is_live(self, url: str = None, timeout: timedelta = None):
615 if url is None:
616 url = self._http_base
617 if timeout is None:
618 timeout = timedelta(seconds=5)
619 try_until = datetime.now() + timeout
620 last_err = ""
621 while datetime.now() < try_until:
622 # noinspection PyBroadException
623 try:
624 r = self.curl_get(url, insecure=True)
625 if r.exit_code == 0:
626 return True
627 time.sleep(.1)
628 except ConnectionRefusedError:
629 log.debug("connection refused")
630 time.sleep(.1)
631 except:
632 if last_err != str(sys.exc_info()[0]):
633 last_err = str(sys.exc_info()[0])
634 log.debug("Unexpected error: %s", last_err)
635 time.sleep(.1)
636 log.debug(f"Unable to contact server after {timeout}")
637 return False
638
639 def is_dead(self, url: str = None, timeout: timedelta = None):
640 if url is None:

Callers 12

apache_reloadMethod · 0.95
apache_restartMethod · 0.95
check_acmeMethod · 0.80
test_h2_711_10Method · 0.80
test_h2_711_11Method · 0.80
test_h2_711_12Method · 0.80
test_h2_700_10Method · 0.80
test_h2_700_11Method · 0.80
test_h2_700_20Method · 0.80
test_h2_710_00Method · 0.80
test_h2_710_01Method · 0.80
test_h2_710_02Method · 0.80

Calls 1

curl_getMethod · 0.95

Tested by 9

test_h2_711_10Method · 0.64
test_h2_711_11Method · 0.64
test_h2_711_12Method · 0.64
test_h2_700_10Method · 0.64
test_h2_700_11Method · 0.64
test_h2_700_20Method · 0.64
test_h2_710_00Method · 0.64
test_h2_710_01Method · 0.64
test_h2_710_02Method · 0.64