File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -162,6 +162,10 @@ def after_request_execute(response):
162162
163163@app .teardown_appcontext
164164def teardown_db (exception = None ):
165+ # drop reference to "user" (if it exists)
166+ if "user" in g :
167+ g .pop ("user" )
168+
165169 # close the db connection
166170 db = g .pop ("db" , None )
167171
Original file line number Diff line number Diff line change @@ -81,7 +81,10 @@ def require_api_key() -> bool:
8181def _get_current_user ():
8282 if "user" not in g :
8383 api_key = resolve_auth_token ()
84- g .user = User .find_user (api_key = api_key )
84+ if api_key :
85+ g .user = User .find_user (api_key = api_key )
86+ else :
87+ g .user = None
8588 return g .user
8689
8790
@@ -122,6 +125,8 @@ def decorated_function(*args, **kwargs):
122125
123126
124127def update_key_last_time_used (user ):
128+ # TODO: reenable this once cc<-->aws latency issues are sorted out, or maybe do this call asynchronously
129+ return
125130 if user :
126131 # update last usage for this user's api key to "now()"
127132 r = redis .Redis (host = REDIS_HOST , password = REDIS_PASSWORD )
You can’t perform that action at this time.
0 commit comments