core/identity: fix slow restart (#4544)

core/identity: fix slow restart (#4542)

Co-authored-by: Caleb Doxsey <cdoxsey@pomerium.com>
This commit is contained in:
backport-actions-token[bot] 2023-09-15 12:39:13 -06:00 committed by GitHub
parent 5a4acc5cd3
commit 516d0d1086
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -117,6 +117,7 @@ func (mgr *Manager) refreshLoop(ctx context.Context, update <-chan updateRecords
}
select {
case <-ctx.Done():
return ctx.Err()
case msg := <-update:
mgr.onUpdateRecords(ctx, msg)
}
@ -128,9 +129,9 @@ func (mgr *Manager) refreshLoop(ctx context.Context, update <-chan updateRecords
// start refreshing
maxWait := time.Minute * 10
nextTime := time.Now().Add(maxWait)
var nextTime time.Time
timer := time.NewTimer(time.Until(nextTime))
timer := time.NewTimer(0)
defer timer.Stop()
for {