-
Notifications
You must be signed in to change notification settings - Fork 33
Description
Hello,
We are encountering an issue when trying to handle start up and shut down using a FastAPI lifespan function implementation which we based off an example in your documentation (linked below). It appears that connect_to_db() and register_collection_catalog() will fail quietly on startup. We suspect it is because our Postgres instance isn't yet ready when these functions are being called on startup.
Calling the /collections endpoint immediately after startup returns:
{"detail":"Could not find collections catalog."}
If we manually trigger the /register endpoint afterward, the collections load correctly.
Your example implementation:
https://developmentseed.org/tipg/advanced/customization/
Our implementation:
https://github.com/SkyTruth/cerulean-cloud/blob/5caa95482e261209ae4ee31d68a111322c112c21/cerulean_cloud/cloud_run_tipg/handler.py
Do you have any recommended changes for getting startup to work using FastAPI lifespan functions?