This commit is contained in:
insanity@loafle.com 2017-05-16 18:04:04 +09:00
parent 41d98d4b91
commit 7ef6e95d70

View File

@ -25,7 +25,7 @@ type Poller struct {
taskCh chan interface{}
}
func Start(ch chan bool, conf *cm.GlobalConfig) error {
func Start(ch chan bool, conf *cm.GlobalConfig) error {
p := GetInstance()
p.gconf = conf
p.startPolling()
@ -39,7 +39,6 @@ func GetTaskCh() chan interface{} {
return p.taskCh
}
func Stop(polStopped chan bool) error {
GetInstance().stop()
polStopped <- true
@ -62,7 +61,7 @@ func UpdateInterval(interval string) error {
return nil
}
func (p *Poller) startPolling() {
func (p *Poller) startPolling() {
go func() {
p.scheduler = &s.Scheduler{}
@ -93,23 +92,23 @@ func (p *Poller) polling(agentId string) {
go func() {
log.Println("POLLING....")
/*
addr := p.gconf.Central.Address + ":" + string(p.gconf.Central.Port)
conn, err := grpc.Dial(addr, grpc.WithInsecure())
if err != nil {
log.Println(err)
return
}
defer conn.Close()
addr := p.gconf.Central.Address + ":" + string(p.gconf.Central.Port)
conn, err := grpc.Dial(addr, grpc.WithInsecure())
if err != nil {
log.Println(err)
return
}
defer conn.Close()
//todo temporary
client := pb.NewStatusClient(conn)
//printStatusStream(client) //stream
out, err := client.Status(context.Background(), &pb.Empty{})
if err != nil {
log.Println(err)
}
//todo temporary
client := pb.NewStatusClient(conn)
//printStatusStream(client) //stream
out, err := client.Status(context.Background(), &pb.Empty{})
if err != nil {
log.Println(err)
}
p.taskCh <- out
p.taskCh <- out
*/
}()
}