From 412b15cc1168449921b8caa1c944669e585af783 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Tue, 3 Dec 2019 10:07:19 +0000 Subject: [PATCH] Clear executor transaction --- db/executor.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/db/executor.go b/db/executor.go index 502f2987..717fe23b 100644 --- a/db/executor.go +++ b/db/executor.go @@ -85,6 +85,7 @@ func (e *executor) execute(ctx context.Context, ast *sql.Query) { if e.tx != nil { e.tx.Cancel() clear(e.id) + e.tx = nil } }() @@ -255,16 +256,19 @@ func (e *executor) operate(ctx context.Context, stm sql.Statement) (res []interf loc, trw = true, false } + defer func() { + if e.tx != nil { + e.tx.Cancel() + clear(e.id) + e.tx = nil + } + }() + err = e.begin(ctx, trw) if err != nil { return } - defer func() { - e.tx.Cancel() - e.tx = nil - }() - } // Mark the beginning of this statement so we