chg: [main] listen to OS signal when ratelimiting

pull/15/head
Jean-Louis Huynen 2020-05-26 16:12:50 +02:00
parent ab248fa3ad
commit a7032f58ee
No known key found for this signature in database
GPG Key ID: 64799157F4BD6B93
1 changed files with 7 additions and 1 deletions

View File

@ -200,7 +200,13 @@ func main() {
// copy routine
go d4Copy(d4p, c)
// Block until the rate limiter allow us to continue
<-ratelimiter
select {
case <-ratelimiter:
continue
case <-s:
logger.Println("Exiting")
exit(d4p, 0)
}
} else if d4.retry > 0 {
go func() {
logger.Println(fmt.Sprintf("Sleeping for %.f seconds before retry...", d4.retry.Seconds()))