fix: 合入后修正迁移计数并唤醒回执推送
This commit is contained in:
@@ -250,3 +250,43 @@ func itoa(i int) string {
|
||||
}
|
||||
return string(b[pos:])
|
||||
}
|
||||
|
||||
func TestC01RejectTooLargeWakesSenderReceipt(t *testing.T) {
|
||||
t.Parallel()
|
||||
e := openDeliveryEnv(t, nil)
|
||||
insertEndpoint(t, e.db, "alice", "", 1, 0)
|
||||
insertEndpoint(t, e.db, "bob", "", 1, 0)
|
||||
ctx := context.Background()
|
||||
aliceConn := LiveConn{ConnID: "c-alice", Ready: true}
|
||||
bobConn := LiveConn{ConnID: "c-bob", Ready: true, MaxReceiveBytes: 50}
|
||||
e.conns.Set("alice", aliceConn)
|
||||
e.conns.Set("bob", bobConn)
|
||||
if err := e.app.OnHandshakeComplete(ctx, "alice", aliceConn); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := e.app.OnHandshakeComplete(ctx, "bob", bobConn); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(func() {
|
||||
e.app.stopPushWorker("alice", "")
|
||||
e.app.stopPushWorker("bob", "")
|
||||
})
|
||||
req := baseSend("big-wake", "bob")
|
||||
b := make([]byte, 80)
|
||||
for i := range b {
|
||||
b[i] = 'a'
|
||||
}
|
||||
req.Body.Data = string(b)
|
||||
if _, err := e.app.Submit(ctx, "alice", port.ConnInfo{}, req); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
deadline := time.Now().Add(2 * time.Second)
|
||||
for time.Now().Before(deadline) {
|
||||
if e.down.FilterType(protocol.TypeReceipt) > 0 {
|
||||
return
|
||||
}
|
||||
time.Sleep(20 * time.Millisecond)
|
||||
}
|
||||
t.Fatalf("sender got no receipt after too_large reject, receipts=%d msgs=%d",
|
||||
e.down.FilterType(protocol.TypeReceipt), e.down.FilterType(protocol.TypeMsg))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user