update hooks

This commit is contained in:
2025-08-01 12:54:28 +03:00
parent 58027bb988
commit 2a48927a08

View File

@@ -28,16 +28,16 @@ import (
"golang.org/x/net/netutil" "golang.org/x/net/netutil"
) )
var nodeApp = app.New() var NodeApp = app.New()
func Run(cmd *cobra.Command, args []string) { func Run(cmd *cobra.Command, args []string) {
nodeApp.InitialHooks( NodeApp.InitialHooks(
Init0Hook, Init1Hook, Init2Hook, Init0Hook, Init1Hook, Init2Hook,
Init3Hook, Init4Hook, Init5Hook, Init3Hook, Init4Hook, Init5Hook,
Init6Hook, Init7Hook, Init6Hook, Init7Hook, Init8Hook,
) )
nodeApp.Run(RunHook) NodeApp.Run(RunHook)
} }
func RunHook(ctx context.Context, cs *corestate.CoreState, x *app.AppX) error { func RunHook(ctx context.Context, cs *corestate.CoreState, x *app.AppX) error {
@@ -96,7 +96,7 @@ func RunHook(ctx context.Context, cs *corestate.CoreState, x *app.AppX) error {
}, "", 0), }, "", 0),
} }
nodeApp.Fallback(func(ctx context.Context, cs *corestate.CoreState, x *app.AppX) { NodeApp.Fallback(func(ctx context.Context, cs *corestate.CoreState, x *app.AppX) {
if err := srv.Shutdown(ctxMain); err != nil { if err := srv.Shutdown(ctxMain); err != nil {
x.Log.Printf("%s: Failed to stop the server gracefully: %s", colors.PrintError(), err.Error()) x.Log.Printf("%s: Failed to stop the server gracefully: %s", colors.PrintError(), err.Error())
} else { } else {
@@ -171,6 +171,6 @@ func RunHook(ctx context.Context, cs *corestate.CoreState, x *app.AppX) error {
} }
<-ctxMain.Done() <-ctxMain.Done()
nodeApp.CallFallback(ctx) NodeApp.CallFallback(ctx)
return nil return nil
} }