From e40928e3f170cfceb95850e4718d9f46ac77d44b Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 27 Sep 2017 15:49:41 +0100 Subject: CHANGES: Update for release --- CHANGES | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index 8b1bc13e..25fbcaeb 100644 --- a/CHANGES +++ b/CHANGES @@ -1,7 +1,7 @@ -0.10.not-released-yet +0.10.0 ===================== -**YYYY-MM-DD** +**2017-09-28** New features ------------ -- cgit v1.2.3 -- cgit v1.2.3 From c15a022de74ef32c92ab45351590bd8b736ca52c Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 4 Oct 2017 10:16:42 +0100 Subject: util.sql: Don't log at error level if a transaction failed and was retried ok --- util/sql.lua | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/util/sql.lua b/util/sql.lua index 61d6af41..71158d4c 100644 --- a/util/sql.lua +++ b/util/sql.lua @@ -217,8 +217,9 @@ function engine:debug(enable) end end local function handleerr(err) - log("error", "Error in SQL transaction: %s", debug_traceback(err, 3)); - return err; + local trace = debug_traceback(err, 3); + log("debug", "Error in SQL transaction: %s", trace); + return { err = err, traceback = trace }; end function engine:_transaction(func, ...) if not self.conn then @@ -238,9 +239,9 @@ function engine:_transaction(func, ...) if not ok then return ok, err; end -- commit failed return success, a, b, c; else - log("debug", "SQL transaction failure [%s]: %s", tostring(func), a); + log("debug", "SQL transaction failure [%s]: %s", tostring(func), a.err); if self.conn then self.conn:rollback(); end - return success, a; + return success, a.err; end end function engine:transaction(...) @@ -248,8 +249,16 @@ function engine:transaction(...) if not ok then local conn = self.conn; if not conn or not conn:ping() then + log("debug", "Database connection was closed. Will reconnect and retry."); self.conn = nil; + log("debug", "Retrying SQL transaction [%s]", tostring((...))); ok, ret = self:_transaction(...); + log("debug", "SQL transaction retry %s", ok and "succeeded" or "failed"); + else + log("debug", "SQL connection is up, so not retrying"); + end + if not ok then + log("error", "Error in SQL transaction: %s", ret); end end return ok, ret; -- cgit v1.2.3 From 03d6a88e608e2027894172728921701f8987d9a8 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 4 Oct 2017 12:06:18 +0200 Subject: CHANGES: Correct date using the power hindsight --- CHANGES | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 25fbcaeb..0fae4f25 100644 --- a/CHANGES +++ b/CHANGES @@ -1,7 +1,7 @@ 0.10.0 ===================== -**2017-09-28** +**2017-10-02** New features ------------ -- cgit v1.2.3