@@ -306,10 +306,10 @@ proc step-set-status {flight job stepno st} {
proc transaction {tables script} {
global errorInfo errorCode
set retries 100
- db-open
while 1 {
set ol {}
set rc [catch {
+ db-open
db-execute BEGIN
db-execute "SET TRANSACTION ISOLATION LEVEL SERIALIZABLE"
lock-tables $tables
@@ -318,6 +318,7 @@ proc transaction {tables script} {
} result]
set ei $errorInfo
set ec $errorCode
+ db-close
if {$rc} {
db-execute ROLLBACK
switch -glob $errorCode {
@@ -333,7 +334,6 @@ proc transaction {tables script} {
}
}
}
- db-close
return -code $rc -errorinfo $ei -errorcode $ec $result
}
}
* Do the db-open inside the catch, so that if it fails we do the rest of the error handling. * Do the db-close before deconstructing the error, so that we necessarily get the db-open reference count right. Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> --- tcl/JobDB-Executive.tcl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)