fix(notify): 根治低带宽控制面阻塞与传输写入卡死
- 为控制消息增加优先级、公平调度、队列字节预算和自适应批处理 - 支持可取消的写门等待,收紧 shared/dedicated bulk、stream 和 Reply 写入边界 - 修复 bulk reset/close、连接 handoff 和安全 profile 切换时序 - 保留旧取消与超时错误契约,新增阶段化 TransportSendError - 增加 ReplyCtx、ReplyObjCtx、写超时配置及黑洞连接和竞态回归测试
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package notify
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestIsTransportDetachedErrorRecognizesWrappedDetach(t *testing.T) {
|
||||
base := transportDetachedError("dedicated bulk read error", io.ErrUnexpectedEOF)
|
||||
for name, err := range map[string]error{
|
||||
"direct": base,
|
||||
"wrapped": fmt.Errorf("bulk reset: %w", base),
|
||||
"transport-send": newTransportSendError(TransportSendStageTransport, base),
|
||||
} {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
if !IsTransportDetachedError(err) {
|
||||
t.Fatalf("IsTransportDetachedError(%v) = false", err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestIsTransportDetachedErrorRejectsOtherErrors(t *testing.T) {
|
||||
for name, err := range map[string]error{
|
||||
"nil": nil,
|
||||
"business": errors.New("remote file became a directory"),
|
||||
"eof": io.EOF,
|
||||
} {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
if IsTransportDetachedError(err) {
|
||||
t.Fatalf("IsTransportDetachedError(%v) = true", err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user