Fix cancellation

This commit is contained in:
Anders Pitman
2021-02-17 10:56:29 -07:00
parent 2b74f6ee0c
commit 37774429df

View File

@@ -131,7 +131,13 @@ func (c *Client) Run(ctx context.Context) error {
if err != nil {
log.Print(err)
}
time.Sleep(2 * time.Second)
select {
case <-ctx.Done():
return nil
case <-time.After(2 * time.Second):
// continue
}
}
}