We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b490960 commit b390850Copy full SHA for b390850
src/diem/jsonrpc/async_client.py
@@ -159,6 +159,9 @@ async def __aenter__(self) -> "AsyncClient":
159
return self
160
161
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`.
165
await self.close()
166
167
# high level functions
src/diem/testing/miniwallet/app/app.py
@@ -138,6 +138,8 @@ async def worker() -> None:
138
try:
139
await asyncio.gather(*[t() for t in self.bg_tasks])
140
except asyncio.CancelledError:
141
+ # when application is shutting down, tasks maybe cancelled.
142
+ # ignore the error and shutdown the worker.
143
return
144
except Exception as e:
145
self.logger.exception(e)
0 commit comments