mirror of https://github.com/hak5/bolt.git
commit
7cb1534948
14
tx.go
14
tx.go
|
@ -5,6 +5,7 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
@ -202,8 +203,17 @@ func (tx *Tx) Commit() error {
|
||||||
// If strict mode is enabled then perform a consistency check.
|
// If strict mode is enabled then perform a consistency check.
|
||||||
// Only the first consistency error is reported in the panic.
|
// Only the first consistency error is reported in the panic.
|
||||||
if tx.db.StrictMode {
|
if tx.db.StrictMode {
|
||||||
if err, ok := <-tx.Check(); ok {
|
ch := tx.Check()
|
||||||
panic("check fail: " + err.Error())
|
var errs []string
|
||||||
|
for {
|
||||||
|
err, ok := <-ch
|
||||||
|
if !ok {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
errs = append(errs, err.Error())
|
||||||
|
}
|
||||||
|
if len(errs) > 0 {
|
||||||
|
panic("check fail: " + strings.Join(errs, "\n"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue