@@ -78,31 +78,27 @@ async def load_templates():
7878@asynccontextmanager
7979async def lifespan (_ : FastAPI ):
8080 # Initialize database
81- await init_db ()
82- print ("Database connection established successfully" )
81+ # await init_db()
82+ # print("Database connection established successfully")
8383
84- # Run database migrations with Redis lock
85- # All workers will wait for the migration to complete before proceeding
86- try :
87- migration_success = await run_migrations_with_lock (
88- redis_client = redis_client ,
89- lock_timeout = 120 , # 2 minutes timeout for the lock
90- max_wait_time = 300 # 5 minutes maximum wait time
91- )
84+ # # Run database migrations with Redis lock
85+ # # All workers will wait for the migration to complete before proceeding
86+ # try:
87+ # migration_success = await run_migrations_with_lock(
88+ # redis_client=redis_client,
89+ # lock_timeout=120, # 2 minutes timeout for the lock
90+ # max_wait_time=300 # 5 minutes maximum wait time
91+ # )
9292
93- if migration_success :
94- print ("Database migrations completed successfully or already done" )
95- else :
96- print ("Warning: Migrations failed or timed out - proceeding with caution" )
97- except Exception as e :
98- print (f"Warning: Failed to run migrations: { str (e )} " )
93+ # if migration_success:
94+ # print("Database migrations completed successfully or already done")
95+ # else:
96+ # print("Warning: Migrations failed or timed out - proceeding with caution")
97+ # except Exception as e:
98+ # print(f"Warning: Failed to run migrations: {str(e)}")
9999
100- # Check Redis connection
101- try :
102- redis_client .ping ()
103- print ("Redis connection established successfully" )
104- except Exception as e :
105- print (f"Warning: Redis connection failed: { str (e )} " )
100+ redis_client .ping ()
101+ print ("Redis connection established successfully" )
106102
107103 # Load all templates from the templates directory
108104 await load_templates ()
0 commit comments