aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Scharinger <rng.dynamics@gmail.com>2021-03-27 22:54:06 +0100
committerAlexander Scharinger <rng.dynamics@gmail.com>2021-03-27 22:55:47 +0100
commitdb57227ae53d3e8bba8a5cf939fb2b165d9ceaaf (patch)
tree6201a5e13abc8780f38c24160f37c9947cf089d8
parent21b330dad19585ec6000d4ce385ebd8619dd07de (diff)
downloadgit-bug-db57227ae53d3e8bba8a5cf939fb2b165d9ceaaf.tar.gz
Github bridge: stop sleep-timer on SIGINT
-rw-r--r--bridge/github/import_mediator.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/bridge/github/import_mediator.go b/bridge/github/import_mediator.go
index 25d9c312..ac094bbb 100644
--- a/bridge/github/import_mediator.go
+++ b/bridge/github/import_mediator.go
@@ -358,8 +358,14 @@ func (mm *importMediator) mQuery(ctx context.Context, query rateLimiter, vars ma
var err error
for i := 0; i < retries; i++ {
// wait a few seconds before retry
- sleepTime := 8 * (i + 1)
- time.Sleep(time.Duration(sleepTime) * time.Second)
+ sleepTime := time.Duration(8*(i+1)) * time.Second
+ timer := time.NewTimer(sleepTime)
+ select {
+ case <-ctx.Done():
+ stop(timer)
+ return ctx.Err()
+ case <-timer.C:
+ }
err = mm.queryOnce(ctx, query, vars)
if err == nil {
// success: done