]> xenbits.xensource.com Git - people/liuw/osstest.git/commitdiff
tcl daemons: make db-reopen actually work
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 7 Jul 2016 12:16:46 +0000 (13:16 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 14 Jul 2016 12:24:22 +0000 (13:24 +0100)
Even if the refcount is >0, we want to actually reconnect.
Also, log something if the close fails.

Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
tcl/JobDB-Executive.tcl

index 4935e133547ca5abfd56b0b3269b8baf7ed4ab57..dae33b5270ecd62c96362ebdf22ddfd433017f91 100644 (file)
@@ -125,9 +125,12 @@ proc db-ensure-closed {} {
 }
 
 proc db-reopen {} {
+    variable dbusers
     logputs stdout "** reopening database **"
-    catch { db-close }
-    db-open
+    if {[catch { db-ensure-closed } emsg]} {
+       logputs stdout "(db disconnect: $emsg)"
+    }
+    if {$dbusers > 0} db-ensure-open
 }
 
 proc db-update-1 {stmt} {