Пример #1
0
func main() {
	cfg := flag.String("c", "cfg.json", "configuration file")
	version := flag.Bool("v", false, "show version")
	flag.Parse()

	if *version {
		fmt.Println(g.VERSION)
		os.Exit(0)
	}

	g.ParseConfig(*cfg)

	g.InitRedisConnPool()
	g.InitHbsClient()

	store.InitHistoryBigMap()

	go http.Start()
	go rpc.Start()

	go cron.SyncStrategies()
	go cron.CleanStale()

	select {}
}
Пример #2
0
func rpcHbsGetStrategies() {
	jg.ParseConfig(judgeConfig)
	jg.InitHbsClient()

	var resp model.StrategiesResponse
	err := jg.HbsClient.Call("Hbs.GetStrategies", model.NullRpcRequest{}, &resp)
	if err != nil {
		fmt.Println("[ERROR] Hbs.GetStrategies:", err)
		return
	}

	fmt.Println("[RESP.] Hbs.GetStrategies:", resp)
	for k, v := range resp.HostStrategies {
		fmt.Printf("Idx:%v, Hostname:%v, Strategies:%v\n", k, v.Hostname, v.Strategies)
	}
}