Skip to content

Commit 0dbfa69

Browse files
committed
kv: run flushRawPending in goroutine to avoid blocking the first caller
The first commitRaw caller that becomes the flusher was blocked synchronously in the flush loop, potentially processing unrelated batches long after its own result was ready. Running the flush in a goroutine lets each caller block only on its own done channel.
1 parent 3b65480 commit 0dbfa69

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

kv/transaction.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func (t *TransactionManager) commitRaw(reqs []*pb.Request) (*TransactionResponse
164164
t.mu.Unlock()
165165

166166
if shouldFlush {
167-
t.flushRawPending()
167+
go t.flushRawPending()
168168
}
169169

170170
res := <-item.done

0 commit comments

Comments
 (0)