mirror of
https://github.com/sartography/spiff-arena.git
synced 2025-01-28 18:24:58 +00:00
71e189afbc
593f33ca wait for db to be ready option 706094a8 demo env and no ssl for spiff realm on that env git-subtree-dir: spiffworkflow-backend git-subtree-split: 593f33ca52ffb049fefd529c3a6bc011cb62e950
29 lines
695 B
Python
29 lines
695 B
Python
"""Grabs tickets from csv and makes process instances."""
|
|
|
|
from spiffworkflow_backend import get_hacked_up_app_for_script
|
|
from flask_bpmn.models.db import db
|
|
import sqlalchemy
|
|
import time
|
|
|
|
|
|
def try_to_connect(start_time: float) -> None:
|
|
try:
|
|
db.first_or_404('select 1')
|
|
except sqlalchemy.exc.DatabaseError as exception:
|
|
if time.time() - start_time > 15:
|
|
raise exception
|
|
else:
|
|
time.sleep(1)
|
|
try_to_connect(start_time)
|
|
|
|
def main() -> None:
|
|
"""Main."""
|
|
app = get_hacked_up_app_for_script()
|
|
start_time = time.time()
|
|
with app.app_context():
|
|
try_to_connect(start_time)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|