Skip to content

Commit

Permalink
debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaraphael committed Jul 28, 2023
1 parent bd1d8ec commit c2ccc8c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cerulean_cloud/cloud_run_tipg/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@ class Config:
async def startup_event() -> None:
"""Connect to database on startup."""
try:
print("XXXDEBUG starting up")
await connect_to_db(app, settings=postgres_settings)
print("XXXDEBUG starting up 2")
assert getattr(app.state, "pool", None)
print("XXXDEBUG starting up 3")

await register_collection_catalog(
app,
Expand All @@ -126,6 +129,11 @@ async def startup_event() -> None:
exclude_functions=db_settings.exclude_functions,
spatial=False, # False means allow non-spatial tables
)
print("XXXDEBUG starting up 4")
print(
"XXXDEBUG starting up app.state.collection_catalog",
app.state.collection_catalog,
)
except: # noqa
app.state.collection_catalog = {}

Expand All @@ -141,9 +149,12 @@ async def shutdown_event() -> None:
async def register_table(request: Request):
"""Manually register tables"""
if not getattr(request.app.state, "pool", None):
print("XXXDEBUG registering")
await connect_to_db(request.app, settings=postgres_settings)

print("XXXDEBUG registering 2")
assert getattr(request.app.state, "pool", None)
print("XXXDEBUG registering 3")
await register_collection_catalog(
request.app,
schemas=db_settings.schemas,
Expand All @@ -157,6 +168,11 @@ async def register_table(request: Request):
exclude_functions=db_settings.exclude_functions,
spatial=False, # False means allow non-spatial tables
)
print("XXXDEBUG registering 4")
print(
"XXXDEBUG registering app.state.collection_catalog",
app.state.collection_catalog,
)


@app.get("/healthz", description="Health Check", tags=["Health Check"])
Expand Down

0 comments on commit c2ccc8c

Please sign in to comment.