From 4131d60c3feb1a1acc621fc4b142c5a92b23248f Mon Sep 17 00:00:00 2001 From: Andrew Sisley Date: Thu, 30 Mar 2023 21:18:26 -0400 Subject: [PATCH] PR FIXUP - Move close of closing chan to within lock --- datastore/memory/memory.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/datastore/memory/memory.go b/datastore/memory/memory.go index 5080b157ee..8eae5b97e6 100644 --- a/datastore/memory/memory.go +++ b/datastore/memory/memory.go @@ -117,15 +117,14 @@ func (d *Datastore) newBasicBatch() ds.Batch { } func (d *Datastore) Close() error { - d.closeOnce.Do(func() { - close(d.closing) - }) d.closeLk.Lock() defer d.closeLk.Unlock() if d.closed { return ErrClosed } + d.closed = true + close(d.closing) close(d.commit) return nil }