From: Michael Tremer Date: Fri, 5 May 2023 14:20:23 +0000 (+0000) Subject: builders: Don't send start/shutdown signal again X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07049a9c2fd9d84bca31fa11d1c4706ee71786b8;p=pbs.git builders: Don't send start/shutdown signal again This saves us some API calls and log messages. Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/builders.py b/src/buildservice/builders.py index 74d5e957..f709e811 100644 --- a/src/buildservice/builders.py +++ b/src/buildservice/builders.py @@ -562,7 +562,7 @@ class Builder(base.DataObject): return state in ("pending", "running") - async def is_shutdown(self): + async def is_shut_down(self): """ Returns True if this builder is shut down """ @@ -589,6 +589,10 @@ class Builder(base.DataObject): """ Starts the instance on AWS """ + # Do nothing if the builder is already running + if await self.is_running(): + return + await asyncio.to_thread(self._start, wait=wait) def _start(self, wait): @@ -645,6 +649,10 @@ class Builder(base.DataObject): """ Stops this instance on AWS """ + # Do nothing if the builder is already shut down + if await self.is_shutting_down() or await self.is_shut_down(): + return + await asyncio.to_thread(self._stop, wait=wait) def _stop(self, wait):