Skip to content

Commit 5a42d8c

Browse files
committed
Improve AIOHTTP example code
1 parent cc194b7 commit 5a42d8c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

examples/socket_mode_async_healthcheck.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,9 @@ async def start_socket_mode(_web_app: web.Application):
5252
global socket_mode_client
5353
socket_mode_client = handler.client
5454

55-
app.web_app().on_startup.append(start_socket_mode)
56-
app.start(8080)
55+
async def shutdown_socket_mode(_web_app: web.Application):
56+
await socket_mode_client.close()
57+
58+
web_app.on_startup.append(start_socket_mode)
59+
web_app.on_shutdown.append(shutdown_socket_mode)
60+
web.run_app(app=web_app, port=8080)

0 commit comments

Comments
 (0)