Skip to content

Commit 4ddcd54

Browse files
committed
fix _run_authentication creating the coroutine result twice
1 parent 4a51ecf commit 4ddcd54

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ninja/operation.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,11 @@ def _run_authentication(self, request: HttpRequest) -> Optional[HttpResponse]:
207207
if is_async_callable(callback) or getattr(callback, "is_async", False):
208208
result = callback(request)
209209
if inspect.iscoroutine(result):
210-
result = async_to_sync(callback)(request)
210+
211+
async def await_result(cor):
212+
return await cor
213+
214+
result = async_to_sync(await_result)(result)
211215
else:
212216
result = callback(request)
213217
except Exception as exc:

0 commit comments

Comments
 (0)