Skip to content

Commit

Permalink
add redis client to app state (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
russbiggs authored Oct 3, 2023
1 parent f22ff97 commit 0801197
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 4 deletions.
1 change: 1 addition & 0 deletions openaq_api/openaq_api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ async def startup_event():
app.state.counter += 1
else:
app.state.counter = 0
app.state.redis_client = redis_client


@app.on_event("shutdown")
Expand Down
1 change: 0 additions & 1 deletion openaq_api/openaq_api/routers/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ async def check_email(request: Request):

@router.get("/verify/{verification_code}")
async def verify(request: Request, verification_code: str, db: DB = Depends()):
print(f"\n\n\nAPPP: { getattr(request.app.state, 'redis_client')}\n\n")
query = """
SELECT
users.users_id, users.is_active, users.expires_on, entities.full_name, users.email_address
Expand Down
2 changes: 0 additions & 2 deletions openaq_api/openaq_api/routers/measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@


def meas_csv(rows, includefields):
print("ROWS\n\n")
print(rows)
output = io.StringIO()
writer = csv.writer(output)
header = [
Expand Down
1 change: 0 additions & 1 deletion openaq_api/openaq_api/v3/routers/countries.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,5 @@ async def fetch_countries(query, db):
{query_builder.where()}
{query_builder.pagination()}
"""
print(sql)
response = await db.fetchPage(sql, query_builder.params())
return response

0 comments on commit 0801197

Please sign in to comment.