diff options
author | Rasmus Dahlberg <rasmus@rgdd.se> | 2023-03-30 16:30:15 +0200 |
---|---|---|
committer | Rasmus Dahlberg <rasmus@rgdd.se> | 2023-03-30 16:30:15 +0200 |
commit | 20dbfa1b1acefc10694fe0cdf467f9c65fb62550 (patch) | |
tree | 9d91cdc4ad2f1cabb3b648e24e9f81d044361d8c | |
parent | 4a36fbdc9972c5b6101d6f3bc9bd0a77c8c83fd4 (diff) |
Minor renaming and re-ordering
-rw-r--r-- | main.go | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -234,9 +234,9 @@ func workGenerator(ctx context.Context, opts options.Options, fp *os.File, quest } } - // initialize ticker - ticker := time.NewTicker(opts.MetricsInterval) - defer ticker.Stop() + // initialize metrics + metrics := time.NewTicker(opts.MetricsInterval) + defer metrics.Stop() startTime := time.Now().Unix() latestTime := startTime latestCount := opts.StartLineInclusive @@ -263,7 +263,10 @@ func workGenerator(ctx context.Context, opts options.Options, fp *os.File, quest select { case <-ctx.Done(): return nextLine, false - case <-ticker.C: + case questionCh <- qna.Question{Domain: scanner.Text()}: + nextLine++ + readCount++ + case <-metrics.C: now := time.Now().Unix() log.Printf("INFO: currently %.1f sites/s, %.1f sites/s since start, at line %d\n", float64(nextLine-latestCount)/float64(now-latestTime), @@ -273,9 +276,6 @@ func workGenerator(ctx context.Context, opts options.Options, fp *os.File, quest latestCount = nextLine latestTime = now - case questionCh <- qna.Question{Domain: scanner.Text()}: - nextLine++ - readCount++ } } |