Skip to content
Myr

Avoid selecting an outdated merger from cache

Before adoption: this commit came in with the history the project adopted, so no landing records it.

We cache a merger for partial input as well, because it is automatically invalidated as soon as the new data comes in. However, there was a race condition where a cached merger for a partial input is used even after the input stream was complete. This commit fixes the problem. Fix #4034

authored by Junegunn Choi · committed by Junegunn Choi · parent 97f1dae · Browse files · 1 file+1 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−1 removed

  • other:+1 added−1 removed

1 file+1 added−1 removed

modified:src/matcher.go+1 added-1 removed
100 unmodified lines
101102 if !cacheCleared {103 if count == prevCount {104 // Look up mergerCache105 if cached, found := m.mergerCache[patternString]; found {105 if cached, found := m.mergerCache[patternString]; found && cached.final == request.final {106 merger = cached107 }108 } else {109 // Invalidate mergerCache
148 unmodified lines