fix(ml): Resolve IPv6 startup crash and healthcheck failure (#22387)

* fix(ml): Resolve IPv6 startup crash and healthcheck failure

Fixes #13782

* fix(ml): updated the fix to use the std lib

* Apply code formatting to __main__.py
This commit is contained in:
Cokodayo
2025-10-06 17:09:40 +01:00
committed by GitHub
parent 075436a5d1
commit 51150a3ed1
2 changed files with 9 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
import os
import sys
from ipaddress import ip_address
import requests
@@ -7,6 +8,7 @@ port = os.getenv("IMMICH_PORT", 3003)
host = os.getenv("IMMICH_HOST", "0.0.0.0")
host = "localhost" if host == "0.0.0.0" else host
host = f"[{host}]" if ip_address(host).version == 6 else host
try:
response = requests.get(f"http://{host}:{port}/ping", timeout=2)