don't start tx on shutdown (#56)

This commit is contained in:
Alex Sharov 2021-09-02 16:33:23 +07:00 committed by GitHub
parent 3b7a086a68
commit b1435d3679
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -334,14 +334,14 @@ func (db *MdbxKV) Close() {
}
func (db *MdbxKV) BeginRo(ctx context.Context) (txn kv.Tx, err error) {
if db.env == nil {
return nil, fmt.Errorf("db closed")
}
select {
case <-ctx.Done():
return nil, ctx.Err()
default:
}
if db.env == nil {
return nil, fmt.Errorf("db closed")
}
defer func() {
if err == nil {