core/identity: fix slow restart

This commit is contained in:
Caleb Doxsey 2023-09-14 15:37:26 -06:00
parent 01672528cb
commit cb4a56b54d

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 {