Skip to content

Commit b390850

Browse files
author
Xiao Li
committed
add some comments
1 parent b490960 commit b390850

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/diem/jsonrpc/async_client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ async def __aenter__(self) -> "AsyncClient":
159159
return self
160160

161161
async def __aexit__(self, *args, **kwargs) -> None: # pyre-ignore
162+
"""use async with to ensure close the client session after used"""
163+
164+
# we don't use `__del__` because close session requires `await`.
162165
await self.close()
163166

164167
# high level functions

src/diem/testing/miniwallet/app/app.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ async def worker() -> None:
138138
try:
139139
await asyncio.gather(*[t() for t in self.bg_tasks])
140140
except asyncio.CancelledError:
141+
# when application is shutting down, tasks maybe cancelled.
142+
# ignore the error and shutdown the worker.
141143
return
142144
except Exception as e:
143145
self.logger.exception(e)

0 commit comments

Comments
 (0)