diff --git a/internals/overlord/logstate/gatherer.go b/internals/overlord/logstate/gatherer.go index 56f842dbc..e727bcebf 100644 --- a/internals/overlord/logstate/gatherer.go +++ b/internals/overlord/logstate/gatherer.go @@ -75,14 +75,8 @@ type logGatherer struct { // logGathererArgs allows overriding the newLogClient method and time values // in testing. type logGathererArgs struct { - tickPeriod time.Duration - - // timeout values for teardown - timeoutCurrentFlush time.Duration - timeoutPullers time.Duration - timeoutMainLoop time.Duration - timeoutFinalFlush time.Duration - + tickPeriod time.Duration + timeoutFinalFlush time.Duration // method to get a new client newClient func(*plan.LogTarget) (logClient, error) } @@ -118,15 +112,6 @@ func fillDefaultArgs(args logGathererArgs) logGathererArgs { if args.tickPeriod == 0 { args.tickPeriod = tickPeriod } - if args.timeoutCurrentFlush == 0 { - args.timeoutCurrentFlush = timeoutCurrentFlush - } - if args.timeoutPullers == 0 { - args.timeoutPullers = timeoutPullers - } - if args.timeoutMainLoop == 0 { - args.timeoutMainLoop = timeoutMainLoop - } if args.timeoutFinalFlush == 0 { args.timeoutFinalFlush = timeoutFinalFlush } @@ -215,18 +200,18 @@ mainLoop: // - Flush out any final logs buffered in the client. func (g *logGatherer) stop() { // Wait up to timeoutCurrentFlush for the current flush to complete (if any) - time.AfterFunc(g.timeoutCurrentFlush, g.clientCancel) + time.AfterFunc(timeoutCurrentFlush, g.clientCancel) // Wait up to timeoutPullers for the pullers to pull the final logs from the // iterator and send to the main loop. - time.AfterFunc(g.timeoutPullers, g.pullers.KillAll) + time.AfterFunc(timeoutPullers, g.pullers.KillAll) // Kill the main loop once either: // - all the pullers are done // - timeoutMainLoop has passed select { case <-g.pullers.Done(): - case <-time.After(g.timeoutMainLoop): + case <-time.After(timeoutMainLoop): } _ = g.tomb.Killf("gatherer stopped")