mirror of
https://github.com/akyaiy/GoSally-mvp.git
synced 2026-01-03 19:32:26 +00:00
update hooks
This commit is contained in:
12
hooks/run.go
12
hooks/run.go
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user