mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-03 04:37:30 +08:00
backpressure: explanation + more rounds
This commit is contained in:
@ -354,6 +354,7 @@ func TestStBackpressureStreamWrite(t *testing.T) {
|
|||||||
stop <- struct{}{}
|
stop <- struct{}{}
|
||||||
contTime := time.Now().Sub(contStart)
|
contTime := time.Now().Sub(contStart)
|
||||||
|
|
||||||
|
// now compare! continuous should've been faster AND larger
|
||||||
if roundsTime < contTime {
|
if roundsTime < contTime {
|
||||||
t.Error("continuous should have been faster")
|
t.Error("continuous should have been faster")
|
||||||
}
|
}
|
||||||
@ -362,10 +363,17 @@ func TestStBackpressureStreamWrite(t *testing.T) {
|
|||||||
t.Error("continuous should have been larger, too!")
|
t.Error("continuous should have been larger, too!")
|
||||||
}
|
}
|
||||||
|
|
||||||
<-time.After(300 * time.Millisecond)
|
// and a couple rounds more for good measure ;)
|
||||||
writeStats()
|
for i := 0; i < 3; i++ {
|
||||||
testSenderWrote(0)
|
// let the sender fill its buffers, it will stop sending.
|
||||||
testSenderWrote(0)
|
<-time.After(300 * time.Millisecond)
|
||||||
|
b, _ := writeStats()
|
||||||
|
testSenderWrote(0)
|
||||||
|
testSenderWrote(0)
|
||||||
|
|
||||||
|
// drain it all, wait again
|
||||||
|
receive(s, b)
|
||||||
|
}
|
||||||
|
|
||||||
// this doesn't work :(:
|
// this doesn't work :(:
|
||||||
// // now for the sugar on top: let's tear down the receiver. it should
|
// // now for the sugar on top: let's tear down the receiver. it should
|
||||||
|
Reference in New Issue
Block a user