Refine data slow test (#3278)

This commit is contained in:
cnderrauber
2024-12-20 10:58:00 +08:00
committed by GitHub
parent c8b644934f
commit 08b58a23af
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ func NewDataChannelReader(bitrate int) *DataChannelReader {
func (d *DataChannelReader) Read(p []byte, sid string) {
for {
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())
continue
}
+3 -3
View File
@@ -715,7 +715,7 @@ func TestDataPublishSlowSubscriber(t *testing.T) {
return
}
dataChannelSlowThreshold := 101024
dataChannelSlowThreshold := 21024
logger.Infow("----------------STARTING TEST----------------", "test", t.Name())
s := createSingleNodeServer(func(c *config.Config) {
@@ -818,13 +818,13 @@ func TestDataPublishSlowSubscriber(t *testing.T) {
time.Sleep(time.Second)
blocked.Store(false)
require.Eventually(t, func() bool { return blocked.Load() }, 30*time.Second, 100*time.Millisecond)
drainSlowSubNotDrop.Store(true)
stopWrite.Store(true)
<-writeStopped
drainSlowSubNotDrop.Store(true)
require.Eventually(t, func() bool {
return writeIdx.Load() == fastDataIndex.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) {