Skip to content

Commit f59c9d1

Browse files
author
Sergio García Prado
committed
ISSUE #475
* Add shields.
1 parent c88bfa9 commit f59c9d1

File tree

1 file changed

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

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
import logging
66
import warnings
7+
from asyncio import (
8+
shield,
9+
)
710
from pathlib import (
811
Path,
912
)
@@ -95,7 +98,7 @@ async def setup(self) -> None:
9598
"""
9699
if not self._already_setup:
97100
logger.debug(f"Setting up a {type(self).__name__!r} instance...")
98-
await self._setup()
101+
await shield(self._setup())
99102
self._already_setup = True
100103

101104
async def _setup(self) -> None:
@@ -111,7 +114,7 @@ async def destroy(self) -> None:
111114
"""
112115
if self._already_setup:
113116
logger.debug(f"Destroying a {type(self).__name__!r} instance...")
114-
await self._destroy()
117+
await shield(self._destroy())
115118
self._already_setup = False
116119

117120
async def _destroy(self) -> None:

0 commit comments

Comments
 (0)