[vlma-devel] commit: Do not compute the version for every request. (Adrien Grand )

git version control git at videolan.org
Tue Nov 4 23:25:49 CET 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Tue Nov  4 21:08:18 2008 +0100| [28113c98fe1260c4659a4c784fb6fabdf13d63d4] | committer: Adrien Grand 

Do not compute the version for every request.

> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=28113c98fe1260c4659a4c784fb6fabdf13d63d4
---

 vlma-watchdog/src/vlc.py |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/vlma-watchdog/src/vlc.py b/vlma-watchdog/src/vlc.py
index d518a34..6d00f9b 100644
--- a/vlma-watchdog/src/vlc.py
+++ b/vlma-watchdog/src/vlc.py
@@ -21,6 +21,7 @@ class VLCRunner(threading.Thread):
 
   def run(self):
     while (self.__shouldRun):
+      self.version = None
       self.logger.info("Running %s %s", conf.VLC_EXE, conf.VLC_ARGS)
       args = conf.VLC_ARGS.split()
       args.insert(0, conf.VLC_EXE)
@@ -31,6 +32,12 @@ class VLCRunner(threading.Thread):
       self.logger.info("VLC exited with return code %d", exit_status)
     self.logger.info("VLC has been stopped")
 
+  def getVersion(self):
+    if(self.version is None):
+      out = os.popen2("%s --version" %conf.VLC_EXE)[1]
+      self.version = out.readline()
+    return self.version
+
   def getPid(self):
     return self.__pid
 
@@ -73,8 +80,7 @@ class VLC:
     return self.runner.getUptime()
 
   def getVersion(self):
-    out = os.popen2("%s --version" %conf.VLC_EXE)[1]
-    return out.readline()
+    return self.runner.getVersion()
 
   def getLogTail(self, sep="\n", lines=50):
     try:



More information about the vlma-devel mailing list