mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-10-24 08:32:02 +08:00
- Add `FlushResponse` to prefer error-aware flushing and unwrap wrapped response writers - Bypass Gin's void `Flush` while maintaining header accounting via `WriteHeaderNow` to keep transport errors observable Closes: #6332
25 lines
725 B
Go
25 lines
725 B
Go
package cache
|
|
|
|
import (
|
|
"sync/atomic"
|
|
"testing"
|
|
)
|
|
|
|
// Issue6332BlockCommit pauses the first commit before it can update the ledger.
|
|
// This hook exists only in the test binary.
|
|
func Issue6332BlockCommit(t *testing.T) (<-chan struct{}, chan<- struct{}, func() int32) {
|
|
t.Helper()
|
|
original := currentAntigravityReasoningReplayKVClient
|
|
entered, release := make(chan struct{}), make(chan struct{})
|
|
var calls atomic.Int32
|
|
currentAntigravityReasoningReplayKVClient = func() (antigravityReasoningReplayKVClient, bool, error) {
|
|
if calls.Add(1) == 2 {
|
|
close(entered)
|
|
<-release
|
|
}
|
|
return original()
|
|
}
|
|
t.Cleanup(func() { currentAntigravityReasoningReplayKVClient = original })
|
|
return entered, release, calls.Load
|
|
}
|