Skip to content

Commit

Permalink
rename tickPeriod to bufferTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
barrettj12 committed Aug 14, 2023
1 parent 97e7d94 commit 9465a3a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions internals/overlord/logstate/gatherer.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import (
)

const (
parserSize = 4 * 1024
tickPeriod = 1 * time.Second
parserSize = 4 * 1024
bufferTimeout = 1 * time.Second

// These constants control the maximum time allowed for each teardown step.
timeoutCurrentFlush = 1 * time.Second
Expand Down Expand Up @@ -76,7 +76,7 @@ type logGatherer struct {
// logGathererArgs allows overriding the newLogClient method and time values
// in testing.
type logGathererArgs struct {
tickPeriod time.Duration
bufferTimeout time.Duration
timeoutFinalFlush time.Duration
// method to get a new client
newClient func(*plan.LogTarget) (logClient, error)
Expand Down Expand Up @@ -112,8 +112,8 @@ func newLogGathererInternal(target *plan.LogTarget, args logGathererArgs) (*logG
}

func fillDefaultArgs(args logGathererArgs) logGathererArgs {
if args.tickPeriod == 0 {
args.tickPeriod = tickPeriod
if args.bufferTimeout == 0 {
args.bufferTimeout = bufferTimeout
}
if args.timeoutFinalFlush == 0 {
args.timeoutFinalFlush = timeoutFinalFlush
Expand Down Expand Up @@ -191,7 +191,7 @@ mainLoop:
logger.Noticef("Error writing logs to target %q: %v", g.targetName, err)
}
// Set timer if not already set
timer.EnsureSet(g.tickPeriod)
timer.EnsureSet(g.bufferTimeout)
}
}

Expand Down
4 changes: 2 additions & 2 deletions internals/overlord/logstate/gatherer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (s *gathererSuite) TestGatherer(c *C) {
func (s *gathererSuite) TestGathererTimeout(c *C) {
received := make(chan []servicelog.Entry, 1)
gathererArgs := logGathererArgs{
tickPeriod: 1 * time.Millisecond,
bufferTimeout: 1 * time.Millisecond,
newClient: func(target *plan.LogTarget) (logClient, error) {
return &testClient{
bufferSize: 5,
Expand All @@ -96,7 +96,7 @@ func (s *gathererSuite) TestGathererTimeout(c *C) {
func (s *gathererSuite) TestGathererShutdown(c *C) {
received := make(chan []servicelog.Entry, 1)
gathererArgs := logGathererArgs{
tickPeriod: 1 * time.Microsecond,
bufferTimeout: 1 * time.Microsecond,
newClient: func(target *plan.LogTarget) (logClient, error) {
return &testClient{
bufferSize: 5,
Expand Down

0 comments on commit 9465a3a

Please sign in to comment.