poller
This commit is contained in:
parent
41d98d4b91
commit
7ef6e95d70
35
poller.go
35
poller.go
|
@ -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
|
||||
*/
|
||||
}()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user