mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-20 12:02:10 +08:00
change: logs
This commit is contained in:
@@ -629,10 +629,10 @@ func getSimulationDuration(params []interface{}) (milliseconds int64) {
|
|||||||
for _, s := range sections {
|
for _, s := range sections {
|
||||||
accProb += s.weight / totalProb
|
accProb += s.weight / totalProb
|
||||||
if r < accProb {
|
if r < accProb {
|
||||||
seconds := s.min + rand.Float64()*(s.max-s.min)
|
milliseconds := int64((s.min + rand.Float64()*(s.max-s.min)) * 1000)
|
||||||
log.Info().Float64("randomSeconds", seconds).
|
log.Info().Int64("random(ms)", milliseconds).
|
||||||
Interface("strategy_params", params).Msg("get simulation duration")
|
Interface("strategy_params", params).Msg("get simulation duration")
|
||||||
return int64(seconds * 1000)
|
return milliseconds
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -649,7 +649,7 @@ func sleepStrict(startTime time.Time, strictMilliseconds int64) {
|
|||||||
|
|
||||||
// if elapsed time is greater than given duration, skip sleep to reduce deviation caused by process time
|
// if elapsed time is greater than given duration, skip sleep to reduce deviation caused by process time
|
||||||
if dur <= 0 {
|
if dur <= 0 {
|
||||||
log.Info().
|
log.Warn().
|
||||||
Int64("elapsed(ms)", elapsed).
|
Int64("elapsed(ms)", elapsed).
|
||||||
Int64("strictSleep(ms)", strictMilliseconds).
|
Int64("strictSleep(ms)", strictMilliseconds).
|
||||||
Msg("elapsed >= simulation duration, skip sleep")
|
Msg("elapsed >= simulation duration, skip sleep")
|
||||||
|
|||||||
@@ -404,7 +404,7 @@ func (dExt *DriverExt) VideoCrawler(configs *VideoCrawlerConfigs) (err error) {
|
|||||||
// check feed type and incr feed count
|
// check feed type and incr feed count
|
||||||
err := currVideoStat.incrFeed(screenResult, dExt)
|
err := currVideoStat.incrFeed(screenResult, dExt)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error().Err(err).Msg("incr feed failed")
|
log.Warn().Err(err).Msg("incr feed failed")
|
||||||
} else {
|
} else {
|
||||||
// simulation watch feed video
|
// simulation watch feed video
|
||||||
sleepStrict(lastSwipeTime, screenResult.Feed.PlayDuration)
|
sleepStrict(lastSwipeTime, screenResult.Feed.PlayDuration)
|
||||||
|
|||||||
Reference in New Issue
Block a user