package main import ( "customer_project/config" "fmt" "github.com/robfig/cron/v3" util "jygit.jydev.jianyu360.cn/data_processing/common_utils" "net" "net/http" "net/rpc" "os" ) var ( updatePool chan []map[string]interface{} updateSp chan bool saveSize int ) func init() { config.Init("./common.toml") InitLog() InitMysql() } func main() { loadData() go RpcService() taskProject() crn := cron.New() _, _ = crn.AddFunc("@every 10m", func() { taskProject() }) crn.Start() ch := make(chan bool, 1) <-ch } func RpcService() { rpc.Register(new(JyService)) // 注册rpc服务 rpc.HandleHTTP() // 采用http协议作为rpc载体 util.Debug(config.Conf.Serve.RpcServer) lis, err := net.Listen("tcp", config.Conf.Serve.RpcServer) if err != nil { util.Debug("fatal error: ", err) } _, _ = fmt.Fprintf(os.Stdout, "%s\n", "start connection") _ = http.Serve(lis, nil) }