-
-
Notifications
You must be signed in to change notification settings - Fork 905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reraise exception from background task #2696
base: master
Are you sure you want to change the base?
Conversation
return { | ||
"type": "http.request", | ||
"body": self._body, | ||
"more_body": False, | ||
} | ||
return {"type": "http.request", "body": self._body, "more_body": False} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore this. It was just getting me crazy.
return { | ||
"type": "http.request", | ||
"body": b"", | ||
"more_body": False, | ||
} | ||
return {"type": "http.request", "body": b"", "more_body": False} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore this. It was just getting me crazy.
return { | ||
"type": "http.request", | ||
"body": chunk, | ||
"more_body": not self._stream_consumed, | ||
} | ||
return {"type": "http.request", "body": chunk, "more_body": not self._stream_consumed} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore this. It was just getting me crazy.
# import traceback | ||
# traceback.print_exc() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you uncomment those lines, you can see that we have the exceptions on the app_exc
, but we don't reraise them at any point.
@@ -175,6 +165,8 @@ async def body_stream() -> typing.AsyncGenerator[bytes, None]: | |||
if not message.get("more_body", False): | |||
break | |||
|
|||
await anyio.sleep(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this is enough to make the switch so we have time to run the coro
task after the break
above.
This shouldn't be the way to solve this issue... Also, it breaks one of the tests.
Currently, the exceptions on the background tasks are swallowed: