diff options
| author | Joshua Watt <JPEWhacker@gmail.com> | 2021-10-06 21:57:06 -0500 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-10-11 11:00:06 +0100 |
| commit | cac6facc9dd125ccf156406f7f3fac84e97f28dc (patch) | |
| tree | 510c7b8ceee7da97b94dbc3096dd621cdc278ee0 /bitbake/lib | |
| parent | baa7f7f62f2cda3cbfdb2b54b4edd4576f176f4b (diff) | |
| download | poky-cac6facc9dd125ccf156406f7f3fac84e97f28dc.tar.gz | |
bitbake: async: Close sync client event loop
Prevents `ResourceWarning: unclosed event loop` warnings when using the
synchronous client and python exits
(Bitbake rev: 8b95972bc04ce52a98c7780184af15a5e95f987b)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
| -rw-r--r-- | bitbake/lib/bb/asyncrpc/client.py | 9 | ||||
| -rw-r--r-- | bitbake/lib/hashserv/client.py | 1 |
2 files changed, 8 insertions, 2 deletions
diff --git a/bitbake/lib/bb/asyncrpc/client.py b/bitbake/lib/bb/asyncrpc/client.py index 50e60d5c31..34960197d1 100644 --- a/bitbake/lib/bb/asyncrpc/client.py +++ b/bitbake/lib/bb/asyncrpc/client.py | |||
| @@ -7,6 +7,7 @@ import asyncio | |||
| 7 | import json | 7 | import json |
| 8 | import os | 8 | import os |
| 9 | import socket | 9 | import socket |
| 10 | import sys | ||
| 10 | from . import chunkify, DEFAULT_MAX_CHUNK | 11 | from . import chunkify, DEFAULT_MAX_CHUNK |
| 11 | 12 | ||
| 12 | 13 | ||
| @@ -129,7 +130,7 @@ class Client(object): | |||
| 129 | # required (but harmless) with it. | 130 | # required (but harmless) with it. |
| 130 | asyncio.set_event_loop(self.loop) | 131 | asyncio.set_event_loop(self.loop) |
| 131 | 132 | ||
| 132 | self._add_methods('connect_tcp', 'close', 'ping') | 133 | self._add_methods('connect_tcp', 'ping') |
| 133 | 134 | ||
| 134 | @abc.abstractmethod | 135 | @abc.abstractmethod |
| 135 | def _get_async_client(self): | 136 | def _get_async_client(self): |
| @@ -163,3 +164,9 @@ class Client(object): | |||
| 163 | @max_chunk.setter | 164 | @max_chunk.setter |
| 164 | def max_chunk(self, value): | 165 | def max_chunk(self, value): |
| 165 | self.client.max_chunk = value | 166 | self.client.max_chunk = value |
| 167 | |||
| 168 | def close(self): | ||
| 169 | self.loop.run_until_complete(self.client.close()) | ||
| 170 | if sys.version_info >= (3, 6): | ||
| 171 | self.loop.run_until_complete(self.loop.shutdown_asyncgens()) | ||
| 172 | self.loop.close() | ||
diff --git a/bitbake/lib/hashserv/client.py b/bitbake/lib/hashserv/client.py index 1a67c6982d..8cfd90d6a8 100644 --- a/bitbake/lib/hashserv/client.py +++ b/bitbake/lib/hashserv/client.py | |||
| @@ -107,7 +107,6 @@ class Client(bb.asyncrpc.Client): | |||
| 107 | super().__init__() | 107 | super().__init__() |
| 108 | self._add_methods( | 108 | self._add_methods( |
| 109 | "connect_tcp", | 109 | "connect_tcp", |
| 110 | "close", | ||
| 111 | "get_unihash", | 110 | "get_unihash", |
| 112 | "report_unihash", | 111 | "report_unihash", |
| 113 | "report_unihash_equiv", | 112 | "report_unihash_equiv", |
