feat: перенос core-логики 2 лабы
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import sys
|
||||
import urllib.request
|
||||
|
||||
from config import APP_PORT
|
||||
|
||||
READY_URL = f"http://127.0.0.1:{APP_PORT}/health/ready"
|
||||
|
||||
REQUEST_TIMEOUT_SEC = 2
|
||||
|
||||
|
||||
def main() -> int:
|
||||
try:
|
||||
with urllib.request.urlopen(READY_URL, timeout=REQUEST_TIMEOUT_SEC) as response:
|
||||
return 0 if response.status == 200 else 1
|
||||
except OSError:
|
||||
return 1
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Reference in New Issue
Block a user