diff options
| author | Ben Johnson <benbjohnson@yahoo.com> | 2014-03-01 12:53:05 -0700 |
|---|---|---|
| committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-03-01 12:53:05 -0700 |
| commit | 3a1b152562a98de231f73e35c4df03994268328e (patch) | |
| tree | f5ea028ad0f740234b4f8a54a6dc137259b84db1 /transaction.go | |
| parent | Merge pull request #57 from benbjohnson/node-aware-cursors (diff) | |
| download | dedo-3a1b152562a98de231f73e35c4df03994268328e.tar.gz dedo-3a1b152562a98de231f73e35c4df03994268328e.tar.xz | |
Ignore multiple transaction commit/rollback/close.
Diffstat (limited to '')
| -rw-r--r-- | transaction.go | 10 |
1 files changed, 7 insertions, 3 deletions
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. |
