EliramShemesh commited on
Commit
03445dc
·
verified ·
1 Parent(s): 927282b

ci: deploy backend from 14cc9fdcae398fd4a9915926e6011bb9e1dc4b2b

Browse files
Files changed (1) hide show
  1. main.py +6 -8
main.py CHANGED
@@ -129,14 +129,12 @@ async def log_requests(request: Request, call_next):
129
 
130
  @app.on_event("startup")
131
  def on_startup():
132
- import threading
133
- def init_db():
134
- try:
135
- create_db_and_tables()
136
- print("\n\033[32m✅ Database initialized successfully\033[0m")
137
- except Exception as e:
138
- print(f"\n\033[33m⚠️ DB init warning: {e}\033[0m")
139
- threading.Thread(target=init_db, daemon=True).start()
140
  print("\n\033[34m📡 Spender API started. Waiting for client to load initial data...\033[0m")
141
 
142
  @app.get("/")
 
129
 
130
  @app.on_event("startup")
131
  def on_startup():
132
+ try:
133
+ create_db_and_tables()
134
+ print("\n\033[32m✅ Database initialized successfully\033[0m")
135
+ except Exception as e:
136
+ print(f"\n\033[33m⚠️ DB init warning: {e}\033[0m")
137
+ raise
 
 
138
  print("\n\033[34m📡 Spender API started. Waiting for client to load initial data...\033[0m")
139
 
140
  @app.get("/")