Message ID | 20231103142640.1936827-12-JPEWhacker@gmail.com |
---|---|
State | New |
Headers | show |
Series | Bitbake Hash Server WebSockets, Alternate Database Backend, and User Management | expand |
diff --git a/lib/bb/asyncrpc/client.py b/lib/bb/asyncrpc/client.py index d27dbf71..628b90ee 100644 --- a/lib/bb/asyncrpc/client.py +++ b/lib/bb/asyncrpc/client.py @@ -161,10 +161,12 @@ class Client(object): self.client.max_chunk = value def close(self): - self.loop.run_until_complete(self.client.close()) - if sys.version_info >= (3, 6): - self.loop.run_until_complete(self.loop.shutdown_asyncgens()) - self.loop.close() + if self.loop: + self.loop.run_until_complete(self.client.close()) + if sys.version_info >= (3, 6): + self.loop.run_until_complete(self.loop.shutdown_asyncgens()) + self.loop.close() + self.loop = None def __enter__(self): return self
Invalidate the loop in the client close() call so that it is not closed twice (which is an error in the asyncio code) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> --- lib/bb/asyncrpc/client.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)