skip restarting if the installed version is the same as the running version

Summary: We don't need to restart users if their running version is the same as their installed version, so we should check that when deciding if we should restart. This will give us more freedom in restarts since we won't have to play with `min_uptime`. I will add a flag to skip this check in case for some reason we need to do so on the fly.

Reviewed By: wez

Differential Revision: D23438306

fbshipit-source-id: b17c0e13789071b8b7c1b15ac5a8deb74a4fd091
This commit is contained in:
Genevieve Helsel 2020-09-02 20:18:08 -07:00 committed by Facebook GitHub Bot
parent cca2991b75
commit 4cc9a3b6de

View File

@ -23,7 +23,7 @@ from typing import Any, Dict, List, Mapping, Optional, Set, Tuple, Type, Union,
import facebook.eden.ttypes as eden_ttypes
import toml
from eden.thrift.legacy import EdenClient, create_thrift_client
from eden.thrift.legacy import EdenClient, EdenNotRunningError, create_thrift_client
from . import configinterpolator, configutil, telemetry, util, version
from .util import (
@ -296,6 +296,14 @@ class EdenInstance:
bi.get("build_package_release", ""),
)
def get_current_and_running_versions(self) -> Tuple[str, Optional[str]]:
try:
running = self.get_running_version()
except EdenNotRunningError:
# return None if EdenFS does not currently appear to be running
running = None
return version.get_current_version(), running
def get_running_version(self) -> str:
"""Get a human-readable string representation of the currently running EdenFS
version.