Commit 3ce3f3a9 authored by Ruslan Drozhdzh's avatar Ruslan Drozhdzh Committed by Matt Holt

caddy: Run OnShutdown callbacks before instance Stop() calls (#2320)

- see https://github.com/coredns/coredns/issues/1666#issuecomment-380624422
parent 86060ef9
...@@ -248,16 +248,16 @@ func (i *Instance) Restart(newCaddyfile Input) (*Instance, error) { ...@@ -248,16 +248,16 @@ func (i *Instance) Restart(newCaddyfile Input) (*Instance, error) {
} }
// success! stop the old instance // success! stop the old instance
err = i.Stop()
if err != nil {
return i, err
}
for _, shutdownFunc := range i.onShutdown { for _, shutdownFunc := range i.onShutdown {
err = shutdownFunc() err = shutdownFunc()
if err != nil { if err != nil {
return i, err return i, err
} }
} }
err = i.Stop()
if err != nil {
return i, err
}
// Execute instantiation events // Execute instantiation events
EmitEvent(InstanceStartupEvent, newInst) EmitEvent(InstanceStartupEvent, newInst)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment