mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-07 00:39:34 +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")
|
log.Warn().Msg("interrupted in feed crawler")
|
||||||
return errors.Wrap(code.InterruptError, "feed crawler interrupted")
|
return errors.Wrap(code.InterruptError, "feed crawler interrupted")
|
||||||
default:
|
default:
|
||||||
|
if err = crawler.clearCurrentVideo(); err != nil {
|
||||||
|
log.Error().Err(err).Msg("clear cache failed")
|
||||||
|
}
|
||||||
|
|
||||||
// swipe to next feed video
|
// swipe to next feed video
|
||||||
log.Info().Msg("swipe to next feed video")
|
log.Info().Msg("swipe to next feed video")
|
||||||
swipeStartTime := time.Now()
|
swipeStartTime := time.Now()
|
||||||
@@ -363,6 +367,19 @@ type Video struct {
|
|||||||
RandomPlayDuration int64 `json:"random_play_duration"` // 随机播放时长(ms)
|
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) {
|
func (vc *VideoCrawler) getCurrentVideo() (video *Video, err error) {
|
||||||
if !vc.driverExt.plugin.Has("GetCurrentVideo") {
|
if !vc.driverExt.plugin.Has("GetCurrentVideo") {
|
||||||
return nil, errors.New("plugin missing GetCurrentVideo method")
|
return nil, errors.New("plugin missing GetCurrentVideo method")
|
||||||
|
|||||||
Reference in New Issue
Block a user