8000 Add missing await in AioHttpIntegration. (#261) · etherscan-io/sentry-python@085f47e · GitHub
[go: up one dir, main page]

Skip to content

Commit 085f47e

Browse files
janLountitaker
authored andcommitted
Add missing await in AioHttpIntegration. (getsentry#261)
* Add missing await in AioHttpIntegration. The replaced _handle method of aiohttp.web.Application is a coroutine itself. So it has to await the call to the original handle otherwise its never awaited. This fixes getsentry#260 Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de> * Add testcase to demonstrate cashing aiohttp This demonstrates the behaviour in getsentry#260. Signed-off-by: Jan Losinski <losinski@wh2.tu-dresden.de>
1 parent 3f9d748 commit 085f47e

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

sentry_sdk/integrations/aiohttp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ async def sentry_app_handle(self, request, *args, **kwargs):
3232
async def inner():
3333
hub = Hub.current
3434
if hub.get_integration(AioHttpIntegration) is None:
35-
return old_handle(self, request, *args, **kwargs)
35+
return await old_handle(self, request, *args, **kwargs)
3636

3737
weak_request = weakref.ref(request)
3838

tests/integrations/aiohttp/test_aiohttp.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,22 @@ async def hello(request):
5353
assert resp.status == 403
5454

5555
assert not events
56+
57+
58+
async def test_half_initialized(sentry_init, aiohttp_client, loop, capture_events):
59+
sentry_init(integrations=[AioHttpIntegration()])
60+
sentry_init()
61+
62+
async def hello(request):
63+
return web.Response(text="hello")
64+
65+
app = web.Application()
66+
app.router.add_get("/", hello)
67+
68+
events = capture_events()
69+
70+
client = await aiohttp_client(app)
71+
resp = await client.get("/")
72+
assert resp.status == 200
73+
74+
assert events == []

0 commit comments

Comments
 (0)
0