poller
This commit is contained in:
parent
ce344d6f50
commit
1b09bf2c49
|
@ -3,12 +3,12 @@ package long_poller_go
|
||||||
import (
|
import (
|
||||||
cm "loafle.com/overflow/agent_api/config_manager"
|
cm "loafle.com/overflow/agent_api/config_manager"
|
||||||
//pb "loafle.com/overflow/crawler_go/grpc" //temp
|
//pb "loafle.com/overflow/crawler_go/grpc" //temp
|
||||||
|
"loafle.com/overflow/agent_api/messages"
|
||||||
s "loafle.com/overflow/scheduler_go"
|
s "loafle.com/overflow/scheduler_go"
|
||||||
"log"
|
"log"
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
"loafle.com/overflow/agent_api/messages"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -90,6 +90,7 @@ func (p *Poller) stop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var once1 sync.Once
|
var once1 sync.Once
|
||||||
|
|
||||||
func (p *Poller) polling(agentId string) {
|
func (p *Poller) polling(agentId string) {
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -97,7 +98,6 @@ func (p *Poller) polling(agentId string) {
|
||||||
|
|
||||||
time.Sleep(time.Second * 20)
|
time.Sleep(time.Second * 20)
|
||||||
|
|
||||||
|
|
||||||
once1.Do(func() {
|
once1.Do(func() {
|
||||||
|
|
||||||
newTask := messages.AgentTask{}
|
newTask := messages.AgentTask{}
|
||||||
|
@ -109,9 +109,6 @@ func (p *Poller) polling(agentId string) {
|
||||||
p.taskCh <- newTask
|
p.taskCh <- newTask
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
addr := p.gconf.Central.Address + ":" + string(p.gconf.Central.Port)
|
addr := p.gconf.Central.Address + ":" + string(p.gconf.Central.Port)
|
||||||
conn, err := grpc.Dial(addr, grpc.WithInsecure())
|
conn, err := grpc.Dial(addr, grpc.WithInsecure())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user