Release 3.8.1.1: lighter idle UI poll, core cache, multicore ping.
Reduce idle CPU (cheap PollUI, binary cache, logbuf cap, DOM fingerprint), speed ping/AWG HostPort, CopyBuffer pool; ship arm64 build and update notes. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package logbuf
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBufferConcurrentWriteAndCap(t *testing.T) {
|
||||
b := New(64)
|
||||
var wg sync.WaitGroup
|
||||
for i := 0; i < 8; i++ {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for j := 0; j < 40; j++ {
|
||||
_, _ = b.Write([]byte("abcdefghij"))
|
||||
}
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
if b.Len() > 64+40 { // allow truncate marker overhead
|
||||
t.Fatalf("len=%d exceeds soft cap", b.Len())
|
||||
}
|
||||
s := b.String()
|
||||
if !strings.Contains(s, "abcdefghij") && !strings.Contains(s, "truncated") {
|
||||
t.Fatalf("unexpected content %q", s)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user