diff --git a/main.go b/main.go index 736921a..6e69316 100644 --- a/main.go +++ b/main.go @@ -106,11 +106,11 @@ func main() { return } - done := make(chan struct{}) + abort := make(chan struct{}) workersExited := make(chan struct{}) setUpInterruptHandler(func() { - close(done) + close(abort) // give the workers a chance to shut down gracefully (some may not, that's ok). select { @@ -127,7 +127,7 @@ func main() { ri := &runInfo{ cfg: cfg, logger: logger, - done: done, + abort: abort, admin: admin, quiet: quiet, } diff --git a/user.go b/user.go index 7c158ad..b4df781 100644 --- a/user.go +++ b/user.go @@ -22,7 +22,7 @@ import ( type runInfo struct { cfg *Config logger logr.Logger - done chan struct{} + abort chan struct{} admin *AdminClient quiet bool blockCount int64 @@ -126,8 +126,8 @@ func runUser(username string, ri *runInfo) (stats, error) { ri.IncBlockCount(len(content) + 1) select { - case <-ri.done: - return stats, fmt.Errorf("aborting user %s", user.Username) + case <-ri.abort: + return stats, nil case <-time.After(time.Millisecond * ri.cfg.CardDelay): default: } @@ -143,7 +143,7 @@ func runUser(username string, ri *runInfo) (stats, error) { if ri.cfg.BoardDelay != 0 { select { - case <-ri.done: + case <-ri.abort: return stats, fmt.Errorf("aborting user %s", user.Username) case <-time.After(time.Millisecond * ri.cfg.BoardDelay): }