2025-06-23 10:15:22 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
2025-07-06 01:49:19 +08:00
|
|
|
"fmt"
|
|
|
|
|
"os"
|
|
|
|
|
|
2025-06-24 22:09:05 +08:00
|
|
|
_ "github.com/gogf/gf/contrib/nosql/redis/v2"
|
2025-07-06 01:49:19 +08:00
|
|
|
"github.com/gogf/gf/v2/os/gproc"
|
|
|
|
|
|
|
|
|
|
_ "blazing/contrib/drivers/pgsql"
|
2025-09-14 01:35:16 +08:00
|
|
|
"blazing/logic/service/fight"
|
2025-07-06 01:49:19 +08:00
|
|
|
|
2025-06-23 12:24:23 +08:00
|
|
|
"blazing/cool"
|
|
|
|
|
|
2025-07-06 01:49:19 +08:00
|
|
|
//"blazing/o/service"
|
|
|
|
|
|
2025-06-23 12:24:23 +08:00
|
|
|
"github.com/gogf/gf/v2/os/gctx"
|
2025-06-23 10:15:22 +08:00
|
|
|
)
|
|
|
|
|
|
2025-07-06 01:49:19 +08:00
|
|
|
func signalHandlerForMain(sig os.Signal) {
|
2025-09-14 01:35:16 +08:00
|
|
|
fight.Fightpool.Release()
|
2025-07-06 01:49:19 +08:00
|
|
|
fmt.Println("MainProcess is shutting down due to signal:", sig.String())
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-23 10:15:22 +08:00
|
|
|
func main() {
|
2025-07-06 11:38:02 +08:00
|
|
|
|
2025-06-23 12:24:23 +08:00
|
|
|
if cool.IsRedisMode {
|
|
|
|
|
go cool.ListenFunc(gctx.New())
|
|
|
|
|
}
|
2025-06-26 23:20:11 +08:00
|
|
|
|
2025-07-06 01:49:19 +08:00
|
|
|
go Start(cool.Config.PortBL) //注入service
|
2025-07-06 17:05:10 +08:00
|
|
|
|
2025-07-06 01:49:19 +08:00
|
|
|
fmt.Println("Process start, pid:", os.Getpid())
|
2025-08-25 04:23:32 +08:00
|
|
|
|
2025-07-06 01:49:19 +08:00
|
|
|
gproc.AddSigHandlerShutdown(
|
|
|
|
|
|
|
|
|
|
signalHandlerForMain,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
gproc.Listen()
|
2025-06-23 10:15:22 +08:00
|
|
|
}
|