Merge pull request #113 from ooni/bug-ooni/probe#1013
Interrupt the nettestGroup loop early on termination
This commit is contained in:
commit
9eaa25656c
|
@ -14,6 +14,11 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func runNettestGroup(tg string, ctx *ooni.Context, network *database.Network) error {
|
func runNettestGroup(tg string, ctx *ooni.Context, network *database.Network) error {
|
||||||
|
if ctx.IsTerminated() == true {
|
||||||
|
log.Debugf("context is terminated, stopping runNettestGroup early")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
group, ok := nettests.NettestGroups[tg]
|
group, ok := nettests.NettestGroups[tg]
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Errorf("No test group named %s", tg)
|
log.Errorf("No test group named %s", tg)
|
||||||
|
@ -31,7 +36,7 @@ func runNettestGroup(tg string, ctx *ooni.Context, network *database.Network) er
|
||||||
ctx.MaybeListenForStdinClosed()
|
ctx.MaybeListenForStdinClosed()
|
||||||
for i, nt := range group.Nettests {
|
for i, nt := range group.Nettests {
|
||||||
if ctx.IsTerminated() == true {
|
if ctx.IsTerminated() == true {
|
||||||
log.Debugf("context is terminated, breaking")
|
log.Debugf("context is terminated, stopping group.Nettests early")
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
log.Debugf("Running test %T", nt)
|
log.Debugf("Running test %T", nt)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user