summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-23 11:48:31 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-25 17:58:11 +0000
commit5ec9511400abc4e3a6c416727a32e326a7d3daae (patch)
treebd72295c8d931fe6f7b687f0bee0f71563483ee8
parent19388a6922e04219d2b218963b56df220fd4b92a (diff)
downloadpoky-5ec9511400abc4e3a6c416727a32e326a7d3daae.tar.gz
poky-5ec9511400abc4e3a6c416727a32e326a7d3daae.tar.bz2
poky-5ec9511400abc4e3a6c416727a32e326a7d3daae.zip
bitbake: prserv/serv: Only restart the server if settings change
The server is now restarting when running commands which doesn't make sense. Only restart if its configuration has changed. This should potentially fix various memory resident bitbake usages too. (Bitbake rev: 0d2c67abf8c92386802eccfbb6b124dd65597941) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/prserv/serv.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/bitbake/lib/prserv/serv.py b/bitbake/lib/prserv/serv.py
index b854ba14b7..3124b07992 100644
--- a/bitbake/lib/prserv/serv.py
+++ b/bitbake/lib/prserv/serv.py
@@ -449,29 +449,35 @@ class PRServiceConfigError(Exception):
def auto_start(d):
global singleton
- # Shutdown any existing PR Server
- auto_shutdown()
-
host_params = list(filter(None, (d.getVar('PRSERV_HOST') or '').split(':')))
if not host_params:
+ # Shutdown any existing PR Server
+ auto_shutdown()
return None
if len(host_params) != 2:
+ # Shutdown any existing PR Server
+ auto_shutdown()
logger.critical('\n'.join(['PRSERV_HOST: incorrect format',
'Usage: PRSERV_HOST = "<hostname>:<port>"']))
raise PRServiceConfigError
- if is_local_special(host_params[0], int(host_params[1])) and not singleton:
+ if is_local_special(host_params[0], int(host_params[1])):
import bb.utils
cachedir = (d.getVar("PERSISTENT_DIR") or d.getVar("CACHE"))
if not cachedir:
logger.critical("Please set the 'PERSISTENT_DIR' or 'CACHE' variable")
raise PRServiceConfigError
- bb.utils.mkdirhier(cachedir)
dbfile = os.path.join(cachedir, "prserv.sqlite3")
logfile = os.path.join(cachedir, "prserv.log")
- singleton = PRServSingleton(os.path.abspath(dbfile), os.path.abspath(logfile), ("localhost",0))
- singleton.start()
+ if singleton:
+ if singleton.dbfile != dbfile:
+ # Shutdown any existing PR Server as doesn't match config
+ auto_shutdown()
+ if not singleton:
+ bb.utils.mkdirhier(cachedir)
+ singleton = PRServSingleton(os.path.abspath(dbfile), os.path.abspath(logfile), ("localhost",0))
+ singleton.start()
if singleton:
host, port = singleton.getinfo()
else: