diff options
-rw-r--r-- | main.go | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -86,9 +86,6 @@ func main() { log.Printf("INFO: starting work generator\n") workGenerator(ctx, opts, fp, questionCh) - if err := ctx.Err(); err != nil { - log.Printf("WARNING: premature shutdown (context cancelled)\n") - } } func await(ctx context.Context, cancel context.CancelFunc) { @@ -98,10 +95,10 @@ func await(ctx context.Context, cancel context.CancelFunc) { signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM) select { case <-sigs: + log.Printf("WARNING: premature shutdown (context cancelled)\n") + cancel() case <-ctx.Done(): } - - cancel() } func work(ctx context.Context, cli *http.Client, timeout time.Duration, question qna.Question, answerCh chan qna.Answer) { |