mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-11-26 10:06:31 +00:00
fix(shared-state): resend an ambiguous in-flight batch at most once
A flush whose reply timed out may have landed in Redis. The flusher kept the batch and resent it every tick, which counted it many times. A batch that never reached the wire is still kept. A batch that may have landed is resent once and then dropped.
This commit is contained in:
@@ -630,7 +630,7 @@ func TestSharedInflightFlushErrorRetains(t *testing.T) {
|
||||
a.begin("p")
|
||||
a.begin("p")
|
||||
end()
|
||||
store.setFailIncr(errors.New("redis down"))
|
||||
store.setFailIncr(¬AppliedError{err: errors.New("redis down")})
|
||||
la.refresh()
|
||||
a.begin("p") // lands on top of the retained deltas
|
||||
la.refresh()
|
||||
@@ -717,7 +717,7 @@ func TestSharedStateNoIdleStopWithPendingDeltas(t *testing.T) {
|
||||
l.nowFn = clk.now
|
||||
l.every = 5 * time.Millisecond
|
||||
in := newSharedInflight(l, []string{"p"}, 20*time.Minute)
|
||||
store.setFailIncr(errors.New("redis down"))
|
||||
store.setFailIncr(¬AppliedError{err: errors.New("redis down")})
|
||||
in.begin("p")
|
||||
clk.advance(sharedStateIdleStop + time.Second)
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
|
||||
Reference in New Issue
Block a user