From 4e344f1fcff05047530013e4597e028e15b63349 Mon Sep 17 00:00:00 2001 From: Simone Basso Date: Wed, 31 Mar 2021 12:19:03 +0200 Subject: [PATCH] fix(ooniprobe): disable maxRuntime when in the background (#276) Part of https://github.com/ooni/probe/issues/1299 --- cmd/ooniprobe/internal/nettests/nettests.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/ooniprobe/internal/nettests/nettests.go b/cmd/ooniprobe/internal/nettests/nettests.go index 9907194..0712691 100644 --- a/cmd/ooniprobe/internal/nettests/nettests.go +++ b/cmd/ooniprobe/internal/nettests/nettests.go @@ -116,11 +116,13 @@ func (c *Controller) Run(builder *engine.ExperimentBuilder, inputs []string) err } maxRuntime := time.Duration(c.Probe.Config().Nettests.WebsitesMaxRuntime) * time.Second + if c.RunType == "timed" && maxRuntime > 0 { + log.Debug("disabling maxRuntime when running in the background") + maxRuntime = 0 + } start := time.Now() c.ntStartTime = start for idx, input := range inputs { - // TODO(bassosimone): should we allow for interruption when running - // in unattended mode? Likewise, should we honor MaxRuntime? if c.Probe.IsTerminated() { log.Info("user requested us to terminate using Ctrl-C") break