Skip to content

Commit f864e32

Browse files
authored
Free the lock before adding to channel (treeverse#1391)
1 parent 300802f commit f864e32

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

graveler/committed/batch.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,16 @@ var (
4343
// If Wait() has already been called, returns an error.
4444
func (bc *BatchCloser) CloseWriterAsync(w ResultCloser) error {
4545
bc.mu.Lock()
46-
defer bc.mu.Unlock()
4746

4847
if bc.err != nil {
4948
// Don't accept new writers if previous error occurred.
5049
// In particular, if Wait has started then this is errMultipleWaitCalls.
50+
bc.mu.Unlock()
5151
return bc.err
5252
}
5353

5454
bc.wg.Add(1)
55+
bc.mu.Unlock()
5556
bc.ch <- w
5657

5758
return nil

0 commit comments

Comments
 (0)