mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-11 18:11:21 +08:00
Merge branch 'enter-live-by-random' into 'master'
fix: clear current video cache before swipe See merge request iesqa/httprunner!6
This commit is contained in:
@@ -160,6 +160,10 @@ func (dExt *DriverExt) VideoCrawler(configs *VideoCrawlerConfigs) (err error) {
|
||||
log.Warn().Msg("interrupted in feed crawler")
|
||||
return errors.Wrap(code.InterruptError, "feed crawler interrupted")
|
||||
default:
|
||||
if err = crawler.clearCurrentVideo(); err != nil {
|
||||
log.Error().Err(err).Msg("clear cache failed")
|
||||
}
|
||||
|
||||
// swipe to next feed video
|
||||
log.Info().Msg("swipe to next feed video")
|
||||
swipeStartTime := time.Now()
|
||||
@@ -363,6 +367,19 @@ type Video struct {
|
||||
RandomPlayDuration int64 `json:"random_play_duration"` // 随机播放时长(ms)
|
||||
}
|
||||
|
||||
func (vc *VideoCrawler) clearCurrentVideo() error {
|
||||
if !vc.driverExt.plugin.Has("ClearCurrentVideo") {
|
||||
return errors.New("plugin missing ClearCurrentVideo method")
|
||||
}
|
||||
|
||||
_, err := vc.driverExt.plugin.Call("ClearCurrentVideo")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "call plugin ClearCurrentVideo failed")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (vc *VideoCrawler) getCurrentVideo() (video *Video, err error) {
|
||||
if !vc.driverExt.plugin.Has("GetCurrentVideo") {
|
||||
return nil, errors.New("plugin missing GetCurrentVideo method")
|
||||
|
||||
Reference in New Issue
Block a user