Skip to content

Commit

Permalink
fix: disable maxRuntime when not WebConnectivity (#302)
Browse files Browse the repository at this point in the history
This commit cherry-picks 6306c09

See ooni/probe#1433

Conflicts:
	internal/version/version.go
  • Loading branch information
bassosimone authored Apr 6, 2021
1 parent 5d8cf60 commit 46d19f4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/ooniprobe/internal/nettests/nettests.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ func (c *Controller) Run(builder *engine.ExperimentBuilder, inputs []string) err
log.Debug("disabling maxRuntime when running in the background")
maxRuntime = 0
}
_, isWebConnectivity := c.nt.(WebConnectivity)
if !isWebConnectivity {
log.Debug("disabling maxRuntime without Web Connectivity")
maxRuntime = 0
}
start := time.Now()
c.ntStartTime = start
for idx, input := range inputs {
Expand Down Expand Up @@ -214,7 +219,8 @@ func (c *Controller) Run(builder *engine.ExperimentBuilder, inputs []string) err
func (c *Controller) OnProgress(perc float64, msg string) {
// when we have maxRuntime, honor it
maxRuntime := time.Duration(c.Probe.Config().Nettests.WebsitesMaxRuntime) * time.Second
if c.RunType == "manual" && maxRuntime > 0 {
_, isWebConnectivity := c.nt.(WebConnectivity)
if c.RunType == "manual" && maxRuntime > 0 && isWebConnectivity {
elapsed := time.Since(c.ntStartTime)
perc = float64(elapsed) / float64(maxRuntime)
eta := maxRuntime.Seconds() - elapsed.Seconds()
Expand Down

0 comments on commit 46d19f4

Please sign in to comment.