Skip to content

Commit

Permalink
service singleton (Chia-Network#6735)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yostra authored Jun 24, 2021
1 parent 1b65328 commit ab4f441
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 0 additions & 5 deletions chia/daemon/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,11 +808,6 @@ def launch_service(root_path: Path, service_command) -> Tuple[subprocess.Popen,

log.debug(f"Launching service with CHIA_ROOT: {os.environ['CHIA_ROOT']}")

lockfile = singleton(service_launch_lock_path(root_path, service_command))
if lockfile is None:
logging.error(f"{service_command}: already running")
raise subprocess.SubprocessError

# Insert proper e
service_array = service_command.split()
service_executable = executable_for_service(service_array[0])
Expand Down
5 changes: 5 additions & 0 deletions chia/server/start_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from sys import platform
from typing import Any, Callable, List, Optional, Tuple

from chia.daemon.server import singleton, service_launch_lock_path
from chia.server.ssl_context import chia_ssl_ca_paths, private_ssl_ca_paths

try:
Expand Down Expand Up @@ -163,6 +164,10 @@ async def start(self, **kwargs) -> None:
)

async def run(self) -> None:
lockfile = singleton(service_launch_lock_path(self.root_path, self._service_name))
if lockfile is None:
self._log.error(f"{self._service_name}: already running")
raise ValueError(f"{self._service_name}: already running")
await self.start()
await self.wait_closed()

Expand Down

0 comments on commit ab4f441

Please sign in to comment.