Fixed wait for db
This commit is contained in:
parent
39a9566e40
commit
dcf771db9b
@ -2,8 +2,9 @@ import socket
|
||||
import time
|
||||
import os
|
||||
|
||||
port = int(os.environ["SQL_PORT"]) # 5432
|
||||
db_name = os.environ["SQL_DATABASE"]
|
||||
port = int(os.environ.get("SQL_PORT")) # 5432
|
||||
db_name = os.environ.get("SQL_HOST")
|
||||
print(f"database at {db_name}:{port}")
|
||||
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
while True:
|
||||
@ -11,5 +12,5 @@ while True:
|
||||
s.connect((db_name, port))
|
||||
s.close()
|
||||
break
|
||||
except socket.error as ex:
|
||||
except socket.error:
|
||||
time.sleep(0.1)
|
||||
Loading…
Reference in New Issue
Block a user