fix: 错误队列不能只读前两个,增加了清除功能,读完全部错误队列

This commit is contained in:
nnbcccscdscdsc
2026-03-24 11:39:02 +08:00
parent 0bd684c1c9
commit 1889679dbe
8 changed files with 771 additions and 60 deletions

View File

@@ -38,6 +38,26 @@ func (failingLogger) LogEvent(latencylog.Event) error {
return errors.New("log failed")
}
type recordingTXTimestampDebugLogger struct {
mu sync.Mutex
records []TXTimestampDebugRecord
}
func (l *recordingTXTimestampDebugLogger) LogTXTimestampDebugRecord(record TXTimestampDebugRecord) error {
l.mu.Lock()
defer l.mu.Unlock()
l.records = append(l.records, record)
return nil
}
func (l *recordingTXTimestampDebugLogger) Records() []TXTimestampDebugRecord {
l.mu.Lock()
defer l.mu.Unlock()
return append([]TXTimestampDebugRecord(nil), l.records...)
}
// TestSendReceiveMessage 验证 transport 可以在单条连接上正常收发 text 和 file 消息。
func TestSendReceiveMessage(t *testing.T) {
tests := []struct {