From 9b84f21daf8196c883ede8f50c99c479b3ef0cbb Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Sat, 1 Apr 2023 10:12:42 +0200 Subject: Rip out -c and -C Helpful for systemd-resolved issue, but unlikely to help if the issue is e.g. recursive DNS resolver that drops look-ups as -c will be cached. --- README.md | 2 ++ internal/options/options.go | 4 ---- main.go | 30 ------------------------------ 3 files changed, 2 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index c4444f6..15d6f79 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,8 @@ where you left off (line `2089`), specify the `-n` option on the next run: ### Too many parallel workers +**TODO:** update, ripped-out -c and -C. + Here's what would happen if the local system cannot handle the number of workers: $ onion-grab -i top-1m.lst -w 1000 -m 15s -C 60s -c rgdd.se diff --git a/internal/options/options.go b/internal/options/options.go index 3d03e19..9a9a38c 100644 --- a/internal/options/options.go +++ b/internal/options/options.go @@ -18,8 +18,6 @@ type Options struct { MaxResponse int64 // Health and metrics - CheckerDomain string - CheckerInterval time.Duration MetricsInterval time.Duration Limit int } @@ -34,8 +32,6 @@ func Parse() (opts Options) { flag.DurationVar(&opts.Timeout, "t", 10*time.Second, "timeout for each website visit") flag.Int64Var(&opts.MaxResponse, "r", 128, "max response body size to accept in MiB") - flag.StringVar(&opts.CheckerDomain, "c", "", "domain with onion location for setup santity-checks") - flag.DurationVar(&opts.CheckerInterval, "C", 10*time.Second, "how often to to run checker") flag.DurationVar(&opts.MetricsInterval, "m", 5*time.Second, "how often to emit metrics") flag.IntVar(&opts.Limit, "l", 16, "rate-limit that kicks in before handing out work in requests/s") diff --git a/main.go b/main.go index 32c9a6b..9725d98 100644 --- a/main.go +++ b/main.go @@ -62,15 +62,6 @@ func main() { await(ctx, cancel) }() - if opts.CheckerDomain != "" { - log.Printf("INFO: starting checker\n") - go func() { - wg.Add(1) - defer wg.Done() - checker(ctx, cancel, &opts, cli) - }() - } - log.Printf("INFO: starting %d workers with rate-limit %d requests/s\n", opts.NumWorkers, opts.Limit) for i := 0; i < opts.NumWorkers; i++ { go func() { @@ -110,27 +101,6 @@ func await(ctx context.Context, cancel context.CancelFunc) { cancel() } -func checker(ctx context.Context, cancel context.CancelFunc, opts *options.Options, cli *http.Client) { - question := qna.Question{opts.CheckerDomain} - answerCh := make(chan qna.Answer, 1) - defer close(answerCh) - - for { - select { - case <-ctx.Done(): - return - case <-time.After(opts.CheckerInterval): - work(ctx, opts, cli, question, answerCh) - answer := <-answerCh - if answer.HTTP == "" && answer.HTML == "" { - log.Printf("ERROR: checker expected onion for %+v", answer) - cancel() - return - } - } - } -} - func workHandler(ctx context.Context, opts options.Options, cli *http.Client, questionCh chan qna.Question, answerCh chan qna.Answer) { for { select { -- cgit v1.2.3