copy_current_request_context can decorate async functions

This commit is contained in:
pgjones 2021-10-16 11:05:56 +01:00 committed by David Lord
parent 6b0c8cdac1
commit 47e4bd5059
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
2 changed files with 4 additions and 1 deletions

View file

@ -169,7 +169,7 @@ def copy_current_request_context(f: t.Callable) -> t.Callable:
def wrapper(*args, **kwargs):
with reqctx:
return f(*args, **kwargs)
return reqctx.app.ensure_sync(f)(*args, **kwargs)
return update_wrapper(wrapper, f)