Refine data slow test (#3278)
This commit is contained in:
@@ -21,7 +21,7 @@ func NewDataChannelReader(bitrate int) *DataChannelReader {
|
|||||||
func (d *DataChannelReader) Read(p []byte, sid string) {
|
func (d *DataChannelReader) Read(p []byte, sid string) {
|
||||||
for {
|
for {
|
||||||
if bitrate := d.bitrate.Bitrate(time.Now()); bitrate > 0 && bitrate > d.target {
|
if bitrate := d.bitrate.Bitrate(time.Now()); bitrate > 0 && bitrate > d.target {
|
||||||
time.Sleep(20 * time.Millisecond)
|
time.Sleep(10 * time.Millisecond)
|
||||||
d.bitrate.AddBytes(0, 0, time.Now())
|
d.bitrate.AddBytes(0, 0, time.Now())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -715,7 +715,7 @@ func TestDataPublishSlowSubscriber(t *testing.T) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
dataChannelSlowThreshold := 101024
|
dataChannelSlowThreshold := 21024
|
||||||
|
|
||||||
logger.Infow("----------------STARTING TEST----------------", "test", t.Name())
|
logger.Infow("----------------STARTING TEST----------------", "test", t.Name())
|
||||||
s := createSingleNodeServer(func(c *config.Config) {
|
s := createSingleNodeServer(func(c *config.Config) {
|
||||||
@@ -818,13 +818,13 @@ func TestDataPublishSlowSubscriber(t *testing.T) {
|
|||||||
time.Sleep(time.Second)
|
time.Sleep(time.Second)
|
||||||
blocked.Store(false)
|
blocked.Store(false)
|
||||||
require.Eventually(t, func() bool { return blocked.Load() }, 30*time.Second, 100*time.Millisecond)
|
require.Eventually(t, func() bool { return blocked.Load() }, 30*time.Second, 100*time.Millisecond)
|
||||||
drainSlowSubNotDrop.Store(true)
|
|
||||||
stopWrite.Store(true)
|
stopWrite.Store(true)
|
||||||
<-writeStopped
|
<-writeStopped
|
||||||
|
drainSlowSubNotDrop.Store(true)
|
||||||
require.Eventually(t, func() bool {
|
require.Eventually(t, func() bool {
|
||||||
return writeIdx.Load() == fastDataIndex.Load() &&
|
return writeIdx.Load() == fastDataIndex.Load() &&
|
||||||
writeIdx.Load() == slowNoDropDataIndex.Load()
|
writeIdx.Load() == slowNoDropDataIndex.Load()
|
||||||
}, 5*time.Second, 50*time.Millisecond)
|
}, 10*time.Second, 50*time.Millisecond, "writeIdx %d, fast %d, slowNoDrop %d", writeIdx.Load(), fastDataIndex.Load(), slowNoDropDataIndex.Load())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFireTrackBySdp(t *testing.T) {
|
func TestFireTrackBySdp(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user