fix(ooniprobe): disable maxRuntime when in the background (#276)

Part of https://github.com/ooni/probe/issues/1299
This commit is contained in:
Simone Basso 2021-03-31 12:19:03 +02:00 committed by GitHub
parent 991b0a6120
commit 4e344f1fcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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