mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 02:33:14 -04:00
Use cancelable contexts for cloud provider plugin refreshes (#4226)
This commit uses a cancelable context to spawn goroutines that refresh records from a cloud DNS provider. The Caddy shutdown routine uses the returned cancel function to terminate existing goroutines when a USR1 reload signal is received. Signed-off-by: Matt Kulka <mkulka@parchment.com>
This commit is contained in:
@@ -87,11 +87,11 @@ func (h *Azure) Run(ctx context.Context) error {
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
log.Infof("Breaking out of Azure update loop: %v", ctx.Err())
|
||||
log.Debugf("Breaking out of Azure update loop for %v: %v", h.zoneNames, ctx.Err())
|
||||
return
|
||||
case <-time.After(1 * time.Minute):
|
||||
if err := h.updateZones(ctx); err != nil && ctx.Err() == nil {
|
||||
log.Errorf("Failed to update zones: %v", err)
|
||||
log.Errorf("Failed to update zones %v: %v", h.zoneNames, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user