aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/main.go b/main.go
index 88260bf..830af03 100644
--- a/main.go
+++ b/main.go
@@ -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) {