mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-06 05:30:05 +00:00
improve check for offline rules (#1013)
* improve check for offline rules * bug fixes * update dependencies * fix error wrap * fix offline check * improve readability
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
"github.com/nezhahq/nezha/cmd/dashboard/controller/waf"
|
||||
"github.com/nezhahq/nezha/cmd/dashboard/rpc"
|
||||
"github.com/nezhahq/nezha/model"
|
||||
"github.com/nezhahq/nezha/pkg/utils"
|
||||
"github.com/nezhahq/nezha/proto"
|
||||
"github.com/nezhahq/nezha/service/singleton"
|
||||
)
|
||||
@@ -154,6 +155,7 @@ func main() {
|
||||
}
|
||||
|
||||
errChan := make(chan error, 2)
|
||||
errHTTPS := errors.New("error from https server")
|
||||
|
||||
if err := graceful.Graceful(func() error {
|
||||
log.Printf("NEZHA>> Dashboard::START ON %s:%d", singleton.Conf.ListenHost, singleton.Conf.ListenPort)
|
||||
@@ -171,12 +173,16 @@ func main() {
|
||||
log.Println("NEZHA>> Graceful::START")
|
||||
singleton.RecordTransferHourlyUsage()
|
||||
log.Println("NEZHA>> Graceful::END")
|
||||
err := muxServerHTTPS.Shutdown(c)
|
||||
return errors.Join(muxServerHTTP.Shutdown(c), err)
|
||||
var err error
|
||||
if muxServerHTTPS != nil {
|
||||
err = muxServerHTTPS.Shutdown(c)
|
||||
}
|
||||
return errors.Join(muxServerHTTP.Shutdown(c), utils.IfOr(err != nil, utils.NewWrapError(errHTTPS, err), nil))
|
||||
}); err != nil {
|
||||
log.Printf("NEZHA>> ERROR: %v", err)
|
||||
if errors.Unwrap(err) != nil {
|
||||
log.Printf("NEZHA>> ERROR HTTPS: %v", err)
|
||||
var wrapError *utils.WrapError
|
||||
if errors.As(err, &wrapError) {
|
||||
log.Printf("NEZHA>> ERROR HTTPS: %v", wrapError.Unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user