Some checks failed
Tests / Backend Tests (Python) (3.10) (push) Has been cancelled
Tests / Backend Tests (Python) (3.11) (push) Has been cancelled
Tests / Backend Tests (Python) (3.12) (push) Has been cancelled
Tests / Frontend Tests (JS) (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / All Tests Passed (push) Has been cancelled
20 lines
523 B
Python
20 lines
523 B
Python
import time
|
|
import pymysql
|
|
|
|
print("Waiting for MySQL to boot...")
|
|
retries = 30
|
|
while retries > 0:
|
|
try:
|
|
conn = pymysql.connect(host='127.0.0.1', port=3306, user='homelab', password='CHANGE_ME', database='homelab')
|
|
conn.close()
|
|
print("MySQL is ready!")
|
|
break
|
|
except Exception as e:
|
|
print(f"Not ready yet, retrying in 2 seconds... ({e})")
|
|
time.sleep(2)
|
|
retries -= 1
|
|
|
|
if retries == 0:
|
|
print("Failed to connect to MySQL after 60 seconds.")
|
|
exit(1)
|