From 919cdfd15447846ee4d3acffb7570463897a7722 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 19 Apr 2023 20:45:10 +0300 Subject: add global timeout --- internal/execute.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'internal/execute.go') diff --git a/internal/execute.go b/internal/execute.go index d8f426f..1029ff7 100644 --- a/internal/execute.go +++ b/internal/execute.go @@ -7,7 +7,7 @@ import ( "time" ) -func execute(state state, config config) state { +func execute(globalCtx context.Context, state state, config config) state { limiterCh := make(chan struct{}, config.CheckConcurrency) inputCh := make(chan namedCheck) outputCh := make(chan checkResult) @@ -40,7 +40,7 @@ func execute(state state, config config) state { inputWg.Done() }() - ctx, cancel := context.WithTimeout(context.Background(), + ctx, cancel := context.WithTimeout(globalCtx, time.Duration(config.CheckTimeoutS)*time.Second) defer cancel() -- cgit v1.2.3