Skip to content

Commit

Permalink
waiting for mariadbd to be active
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasLecocq committed Sep 20, 2024
1 parent e374df1 commit 345d411
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions msnoise_db/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ def is_mariadbd_active():
if current_os == "Linux" or current_os == "Darwin": # Darwin is macOS
try:
# Run systemctl is-active command to check if mariadb service is active
subprocess.run(["systemctl", "is-active", "--quiet", "mariadbd"], check=True, stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
subprocess.run(["systemctl", "is-active", "mariadbd"], check=True)
return True
except subprocess.CalledProcessError:
return False
Expand Down Expand Up @@ -158,9 +157,9 @@ def start_server():
print(open(os.path.join(logdir, "err.log"), "r").read())

# Loop until MariaDB service is active
while not is_mariadbd_active():
print("Waiting for mariadb service to start...")
time.sleep(2) # Sleep for 2 seconds before checking again
# while not is_mariadbd_active():
print("Waiting 20s for mariadb service to start...")
time.sleep(20) # Sleep for 2 seconds before checking again

with open(PID_FILE, 'w') as f:
f.write(str(process.pid))
Expand Down

0 comments on commit 345d411

Please sign in to comment.