From 2fa1c6cd7b840fc87e2b696cb672f851336e7769 Mon Sep 17 00:00:00 2001 From: rasmus Date: Sun, 6 Nov 2022 16:11:23 +0200 Subject: [PATCH] remove sigCatchupped; it has no use after refactor (refactor: used to not have WithLabelValues) --- cmd/submit.go | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/cmd/submit.go b/cmd/submit.go index 30dfdb7..8f68218 100644 --- a/cmd/submit.go +++ b/cmd/submit.go @@ -51,14 +51,6 @@ const SendQueueLimit = 1024 func (s *submitter) shipFile(ctx context.Context, name string, deleteAfterRead bool) { baseName := filepath.Base(name) - sigCatchupped := make(chan struct{}, 1) - go func() { - <-sigCatchupped - close(sigCatchupped) // once - - promCatchupDone.WithLabelValues(baseName).Add(1) - }() - sendChan := make(chan mLog, SendQueueLimit) defer close(sendChan) @@ -67,7 +59,7 @@ func (s *submitter) shipFile(ctx context.Context, name string, deleteAfterRead b // TODO: better way to kill or wait for mongo sendQueue before retrying (or duplicates?) wait.ManagedExponentialBackoffWithContext(ctx, defaultBackoff(), func() (done bool, _ error) { // - err := s.shipFileRoutine(ctx, name, sendChan, sigCatchupped) + err := s.shipFileRoutine(ctx, name, sendChan) if err == nil { return true, nil } @@ -78,7 +70,7 @@ func (s *submitter) shipFile(ctx context.Context, name string, deleteAfterRead b }) } -func (s *submitter) shipFileRoutine(ctx context.Context, name string, sendQueue chan<- mLog, sigCatchupped chan<- struct{}) error { +func (s *submitter) shipFileRoutine(ctx context.Context, name string, sendQueue chan<- mLog) error { baseName := filepath.Base(name) // TODO: better way for respecting ?killing sender for retry @@ -119,6 +111,8 @@ func (s *submitter) shipFileRoutine(ctx context.Context, name string, sendQueue } var catchUpped bool // cache + promCatchupDone.WithLabelValues(baseName).Set(0) + for { select { case err := <-errChan: @@ -133,10 +127,7 @@ func (s *submitter) shipFileRoutine(ctx context.Context, name string, sendQueue catchUpped = line.EndOffset > startSize if catchUpped { - select { - case sigCatchupped <- struct{}{}: - default: - } + promCatchupDone.WithLabelValues(baseName).Set(1) } }