[vlma-devel] commit: Fix restarting of VLC. (Adrien Grand )

git version control git at videolan.org
Tue Oct 21 22:20:33 CEST 2008


vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Tue Oct 21 22:19:20 2008 +0200| [9e7a24b4c34660f9421b22c738cc8a6c71a88f03] | committer: Adrien Grand 

Fix restarting of VLC.

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

 vlma-watchdog/src/vlc.py |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/vlma-watchdog/src/vlc.py b/vlma-watchdog/src/vlc.py
index 9cb054e..78cf087 100644
--- a/vlma-watchdog/src/vlc.py
+++ b/vlma-watchdog/src/vlc.py
@@ -69,6 +69,7 @@ class VLC:
       logger.error("Cannot start VLC, another instance is still running.")
       logger.info("Please stop VLC first")
     else:
+      self.runner = VLCRunner()
       self.runner.start()
 
   def stop(self):
@@ -92,24 +93,24 @@ class Monitor(threading.Thread):
       time.sleep(1)
       cpuLoad = self.getCpuLoad()
       if(cpuLoad >= CPU_LOAD_THRESHOLD):
-        logger.warn("CPU load is " + cpuLoad + ", VLC restart triggered")
+        logger.warn("CPU load is %f, VLC restart triggered", cpuLoad)
         self.vlc.stop()
         # Because load won't go down in one millisecond
         logger.info("Waiting for the load to decrease")
         while(True):
-          time.sleep(1)
-          if(self.getCpuLoad() >= CPU_LOAD_THRESHOLD):
+          time.sleep(5)
+          if(self.getCpuLoad() < CPU_LOAD_THRESHOLD):
             break
         self.vlc.start()
         continue
       vlcCpu = self.getVlcCpu()
       if(vlcCpu >= VLC_CPU_THRESHOLD):
-        logger.warn("CPU usage of VLC is " + vlcCpu + "%, VLC restart triggered")
+        logger.warn("CPU usage of VLC is %f, VLC restart triggered", vlcCpu)
         self.vlc.restart()
         continue
       vlcMem = self.getVlcMem()
       if(vlcMem >= VLC_MEMORY_THRESHOLD):
-        logger.warn("Memory usage is " + vlcMem + "%, VLC restart triggered")
+        logger.warn("Memory usage is %f, VLC restart triggered", vlcMem)
         self.vlc.restart()
         continue
 



More information about the vlma-devel mailing list