Skip to content

Commit

Permalink
avoid spin loop in certain configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
rboyer committed Mar 18, 2019
1 parent 473db0d commit ff0f4c0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions agent/consul/acl_token_exp.go
Expand Up @@ -20,6 +20,16 @@ func (s *Server) startACLTokenReaping() {
ctx, cancel := context.WithCancel(context.Background())
s.aclTokenReapCancel = cancel

// Do a quick check for config settings that would imply the goroutine
// below will just spin forever.
//
// We can only check the config settings here that cannot change without a
// restart, so we omit the check for a non-empty replication token as that
// can be changed at runtime.
if !s.InACLDatacenter() && !s.config.ACLTokenReplication {
return
}

go func() {
limiter := rate.NewLimiter(aclTokenReapingRateLimit, aclTokenReapingBurst)

Expand Down

0 comments on commit ff0f4c0

Please sign in to comment.