Skip to content

Commit 32223e7

Browse files
author
Sergio García Prado
committed
* Propagate exception to graceful_shutdown
1 parent 5b9650d commit 32223e7

File tree

1 file changed

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

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,19 @@ def launch(self) -> NoReturn:
124124

125125
logger.info("Starting microservice...")
126126

127+
exception = None
127128
try:
128129
self.loop.run_until_complete(self.setup())
129130
self.loop.run_until_complete(self.entrypoint.__aenter__())
130131
logger.info("Microservice is up and running!")
131132
self.loop.run_forever()
132-
except KeyboardInterrupt: # pragma: no cover
133+
except KeyboardInterrupt as exc: # pragma: no cover
133134
logger.info("Stopping microservice...")
135+
exception = exc
136+
except Exception as exc: # pragma: no cover
137+
exception = exc
134138
finally:
135-
self.graceful_shutdown()
139+
self.graceful_shutdown(exception)
136140

137141
def graceful_shutdown(self, err: Exception = None) -> None:
138142
"""Shutdown the execution gracefully.

0 commit comments

Comments
 (0)