From 3a1b152562a98de231f73e35c4df03994268328e Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Sat, 1 Mar 2014 12:53:05 -0700 Subject: Ignore multiple transaction commit/rollback/close. --- transaction.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'transaction.go') diff --git a/transaction.go b/transaction.go index d680e24..857defb 100644 --- a/transaction.go +++ b/transaction.go @@ -40,10 +40,14 @@ func (t *Transaction) id() txnid { // Close closes the transaction and releases any pages it is using. func (t *Transaction) Close() { - if t.rwtransaction != nil { - t.rwtransaction.Rollback() + if t.db != nil { + if t.rwtransaction != nil { + t.rwtransaction.Rollback() + } else { + t.db.removeTransaction(t) + t.db = nil + } } - t.db.removeTransaction(t) } // DB returns a reference to the database that created the transaction. -- cgit v1.2.3