Do the notifies only once during startup

This commit is contained in:
Miek Gieben 2016-04-14 21:22:12 +01:00
parent 885e6e8246
commit fb3286983b

View file

@ -20,8 +20,11 @@ func File(c *Controller) (middleware.Middleware, error) {
for _, n := range zones.Names {
if len(zones.Z[n].TransferTo) > 0 {
c.Startup = append(c.Startup, func() error {
zones.Z[n].Notify()
return err
zones.Z[n].StartupOnce.Do(func() {
if len(zones.Z[n].TransferTo) > 0 {
zones.Z[n].Notify()
}
})
})
}
}