mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-09 01:17:30 +08:00
fix: if entry from the preview to the main stream fails, block the use of the exit live room feature
This commit is contained in:
@@ -202,14 +202,15 @@ func (dExt *DriverExt) VideoCrawler(configs *VideoCrawlerConfigs) (err error) {
|
|||||||
|
|
||||||
switch currentVideo.Type {
|
switch currentVideo.Type {
|
||||||
case VideoType_PreviewLive:
|
case VideoType_PreviewLive:
|
||||||
|
isFeed = true
|
||||||
// 直播预览流
|
// 直播预览流
|
||||||
var skipEnterLive bool
|
var skipEnterLive bool
|
||||||
if crawler.isLiveTargetAchieved() {
|
if crawler.isLiveTargetAchieved() {
|
||||||
log.Info().Interface("video", currentVideo).
|
log.Info().Interface("video", currentVideo).
|
||||||
Msg("live count achieved, skip entering live room")
|
Msg("live count achieved, skip entering live room")
|
||||||
skipEnterLive = true
|
skipEnterLive = true
|
||||||
} else if rand.Float64() <= 0.50 {
|
} else if rand.Float64() <= 0.70 {
|
||||||
// 50% chance skip entering live room
|
// 70% chance skip entering live room
|
||||||
log.Info().Msg("skip entering preview live by 50% chance")
|
log.Info().Msg("skip entering preview live by 50% chance")
|
||||||
skipEnterLive = true
|
skipEnterLive = true
|
||||||
}
|
}
|
||||||
@@ -234,7 +235,6 @@ func (dExt *DriverExt) VideoCrawler(configs *VideoCrawlerConfigs) (err error) {
|
|||||||
sleepTime := math.Min(float64(currentVideo.SimulationPlayDuration), float64(currentVideo.RandomPlayDuration))
|
sleepTime := math.Min(float64(currentVideo.SimulationPlayDuration), float64(currentVideo.RandomPlayDuration))
|
||||||
currentVideo.PlayDuration = int64(sleepTime)
|
currentVideo.PlayDuration = int64(sleepTime)
|
||||||
}
|
}
|
||||||
isFeed = false
|
|
||||||
fallthrough
|
fallthrough
|
||||||
|
|
||||||
case VideoType_Live:
|
case VideoType_Live:
|
||||||
@@ -277,11 +277,12 @@ func (dExt *DriverExt) VideoCrawler(configs *VideoCrawlerConfigs) (err error) {
|
|||||||
log.Info().Interface("live", currentVideo).
|
log.Info().Interface("live", currentVideo).
|
||||||
Msg("live count achieved, exit live room")
|
Msg("live count achieved, exit live room")
|
||||||
exitLive = true
|
exitLive = true
|
||||||
} else if rand.Float64() <= 0.40 {
|
} else if rand.Float64() <= 0.50 {
|
||||||
// 10% chance exit live room
|
// 50% chance exit live room
|
||||||
log.Info().Msg("exit live room by 10% chance")
|
log.Info().Msg("exit live room by 10% chance")
|
||||||
exitLive = true
|
exitLive = true
|
||||||
}
|
}
|
||||||
|
// isFeed:通过预览流进入内流失败的情况下,防止使用退出直播间逻辑,影响:首次进入内流,至少会消费两个直播间才能退出
|
||||||
if (!isFeed) && exitLive && currentVideo.Type == VideoType_Live {
|
if (!isFeed) && exitLive && currentVideo.Type == VideoType_Live {
|
||||||
err = crawler.exitLiveRoom()
|
err = crawler.exitLiveRoom()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user