mirror of
https://github.com/caddyserver/caddy.git
synced 2025-02-02 06:02:59 +08:00
caddy: Run OnShutdown callbacks before instance Stop() calls (#2320)
- see https://github.com/coredns/coredns/issues/1666#issuecomment-380624422
This commit is contained in:
parent
86060ef9b4
commit
3ce3f3a96a
8
caddy.go
8
caddy.go
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user