From 4d57573bac128b7ecacaf1336993d8030734dd7d Mon Sep 17 00:00:00 2001 From: postables Date: Fri, 8 May 2020 23:42:09 -0700 Subject: [PATCH] leveldb: implement code review suggestions --- leveldb/datastore.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/leveldb/datastore.go b/leveldb/datastore.go index f3c752a..c041be3 100644 --- a/leveldb/datastore.go +++ b/leveldb/datastore.go @@ -147,9 +147,7 @@ func (d *Datastore) DiskUsage() (du uint64, err error) { // Close shuts down leveldb func (d *Datastore) Close() (err error) { - if d.closed.Load() { - err = ErrClosed - } + err = ErrClosed d.close.Do(func() { d.closeLock.Lock() err = d.db.Close()