Skip to content

Commit be692f8

Browse files
author
Sergio García Prado
committed
ISSUE #346
* Fix bug related with a blocking status related with pool dependencies.
1 parent 6115bba commit be692f8

File tree

1 file changed

+9
-2
lines changed
  • packages/core/minos-microservice-common/minos/common

1 file changed

+9
-2
lines changed

packages/core/minos-microservice-common/minos/common/pools.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
ABC,
99
)
1010
from asyncio import (
11+
gather,
1112
sleep,
1213
)
1314
from typing import (
@@ -59,10 +60,15 @@ def _from_config(cls, config: Config, **kwargs) -> PoolFactory:
5960
return cls(config, **kwargs)
6061

6162
async def _destroy(self) -> None:
62-
for pool in self._pools.values():
63-
await pool.destroy()
63+
await self._destroy_pools()
6464
await super()._destroy()
6565

66+
async def _destroy_pools(self):
67+
logger.debug("Destroying pools...")
68+
futures = (pool.destroy() for pool in self._pools.values())
69+
await gather(*futures)
70+
logger.debug("Destroyed pools!")
71+
6672
def get_pool(self, type_: str, key: Optional[str] = None, **kwargs) -> Pool:
6773
"""Get a pool from the factory.
6874
@@ -145,6 +151,7 @@ async def _destroy(self) -> None:
145151
logger.info("Waiting for instances releasing...")
146152
while len(self._used):
147153
await sleep(0.1)
154+
logger.info("Released instances!")
148155

149156
await self.close()
150157

0 commit comments

Comments
 (0)