notify: Don't send ready after error (fix #5003)

Also simplify the notify package quite a bit.
Also move stop notification into better place.
Add ability to send status or error.
This commit is contained in:
Matthew Holt
2022-09-02 09:23:51 -06:00
parent 66959d9f18
commit 59286d2c7e
6 changed files with 71 additions and 83 deletions

View File

@ -40,7 +40,6 @@ import (
"sync"
"time"
"github.com/caddyserver/caddy/v2/notify"
"github.com/caddyserver/certmagic"
"github.com/prometheus/client_golang/prometheus"
"go.uber.org/zap"
@ -1020,10 +1019,6 @@ func handleStop(w http.ResponseWriter, r *http.Request) error {
}
}
if err := notify.NotifyStopping(); err != nil {
Log().Error("unable to notify stopping to service manager", zap.Error(err))
}
exitProcess(context.Background(), Log().Named("admin.api"))
return nil
}