mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 14:58:03 +03:00
cli: do not start if the current daemon is already starting
Summary: When EdenFS is starting, `eden start` will attempt to start another EdenFS daemon then it will get a flock error. On Windows, sometimes we saw a long EdenFS startup process, and this behavior misleads people to think they are not able to start EdenFS. Reviewed By: xavierd Differential Revision: D35799954 fbshipit-source-id: 5f58e3ad89962f61d233f962a3e464fe55a9cd8b
This commit is contained in:
parent
ef8e6b2c22
commit
fc5f91a30e
@ -1543,8 +1543,13 @@ class StartCmd(Subcmd):
|
||||
# Check to see if edenfs is already running
|
||||
health_info = instance.check_health()
|
||||
if not is_takeover:
|
||||
msg = None
|
||||
if health_info.is_healthy():
|
||||
msg = f"EdenFS is already running (pid {health_info.pid})"
|
||||
elif health_info.is_starting():
|
||||
msg = f"EdenFS is already starting (pid {health_info.pid})"
|
||||
|
||||
if msg:
|
||||
if args.if_not_running:
|
||||
print(msg)
|
||||
return 0
|
||||
|
@ -71,6 +71,9 @@ class HealthStatus(object):
|
||||
def is_healthy(self) -> bool:
|
||||
return self.status == fb303_status.ALIVE
|
||||
|
||||
def is_starting(self) -> bool:
|
||||
return self.status == fb303_status.STARTING
|
||||
|
||||
def __str__(self) -> str:
|
||||
return "(%s, pid=%s, uptime=%s, detail=%r)" % (
|
||||
fb303_status._VALUES_TO_NAMES.get(self.status, str(self.status)),
|
||||
|
Loading…
Reference in New Issue
Block a user