mirror of
https://github.com/coredns/coredns.git
synced 2025-11-01 02:33:14 -04:00
Only transfer a zone once (#117)
Use sync.Once to only transfer a zone once. Fixes #115
This commit is contained in:
@@ -17,13 +17,12 @@ func Secondary(c *Controller) (middleware.Middleware, error) {
|
||||
for _, n := range zones.Names {
|
||||
if len(zones.Z[n].TransferFrom) > 0 {
|
||||
c.Startup = append(c.Startup, func() error {
|
||||
err := zones.Z[n].TransferIn()
|
||||
return err
|
||||
})
|
||||
c.Startup = append(c.Startup, func() error {
|
||||
go func() {
|
||||
zones.Z[n].Update()
|
||||
}()
|
||||
zones.Z[n].StartupOnce.Do(func() {
|
||||
zones.Z[n].TransferIn()
|
||||
go func() {
|
||||
zones.Z[n].Update()
|
||||
}()
|
||||
})
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user