From 46d19f47ecc52cc2af9f24effff4433881d5f9df Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Tue, 6 Apr 2021 20:48:56 +0200 Subject: [PATCH] fix: disable maxRuntime when not WebConnectivity (#302) This commit cherry-picks https://github.com/ooni/probe-cli/commit/6306c09963c3e05f5a1eb1a48ae226baa40ff3a1 See https://github.com/ooni/probe/issues/1433 Conflicts: internal/version/version.go --- cmd/ooniprobe/internal/nettests/nettests.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/ooniprobe/internal/nettests/nettests.go b/cmd/ooniprobe/internal/nettests/nettests.go index 89dd005..5e5f9f2 100644 --- a/cmd/ooniprobe/internal/nettests/nettests.go +++ b/cmd/ooniprobe/internal/nettests/nettests.go @@ -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 { @@ -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()