spiffworkflow-backend/bin/wait_for_db_to_be_ready.py

18 lines
349 B
Python
Raw Normal View History

2022-10-25 20:50:25 +00:00
"""Wait for db to be ready."""
import time
2022-10-17 02:31:55 +00:00
2022-10-25 20:50:25 +00:00
from spiffworkflow_backend import create_app
from spiffworkflow_backend.helpers.db_helper import try_to_connect
2022-10-17 02:31:55 +00:00
2022-10-17 02:31:55 +00:00
def main() -> None:
"""Main."""
2022-10-25 20:50:25 +00:00
app = create_app()
2022-10-17 02:31:55 +00:00
start_time = time.time()
with app.app_context():
try_to_connect(start_time)
if __name__ == "__main__":
main()