diff options
| author | Paul Buetow <paul@buetow.org> | 2023-04-19 20:45:10 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2023-04-19 20:45:10 +0300 |
| commit | 919cdfd15447846ee4d3acffb7570463897a7722 (patch) | |
| tree | dd822801a58873b63e342ad510cb13d7696d98f7 /internal/execute.go | |
| parent | e023a59312c3fa5e768dfea6b73c7647242a9f5a (diff) | |
add global timeout
Diffstat (limited to 'internal/execute.go')
| -rw-r--r-- | internal/execute.go | 4 |
1 files changed, 2 insertions, 2 deletions
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() |
