long poller
This commit is contained in:
parent
c2b8b106ab
commit
59d517cb32
16
poller.go
16
poller.go
|
@ -1,20 +1,18 @@
|
|||
package long_poller_go
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"context"
|
||||
"google.golang.org/grpc"
|
||||
"loafle.com/overflow/cron_go"
|
||||
"log"
|
||||
"sync"
|
||||
|
||||
"context"
|
||||
pb "loafle.com/overflow/crawler_go/grpc" //temp
|
||||
"log"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
POLLING_ID = "OVERFLOW_LONG_POLLING"
|
||||
DEFAULT_INTERVAL = uint64(5)
|
||||
DEFAULT_INTERVAL = uint64(3)
|
||||
API_SERVER_ADDR = "127.0.0.1:50052"
|
||||
)
|
||||
|
||||
|
@ -44,7 +42,6 @@ func (p *LongPoller) Stop() {
|
|||
}
|
||||
|
||||
func (p *LongPoller) polling(agentId string) {
|
||||
fmt.Printf("[%s] %s :: LongPolling\n", time.Now(), agentId)
|
||||
|
||||
conn, err := grpc.Dial(API_SERVER_ADDR, grpc.WithInsecure())
|
||||
if err != nil {
|
||||
|
@ -59,7 +56,12 @@ func (p *LongPoller) polling(agentId string) {
|
|||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
log.Println(out)
|
||||
|
||||
p.dispatchNotify(out)
|
||||
}
|
||||
|
||||
func (p *LongPoller) dispatchNotify(result interface{}) {
|
||||
log.Printf("Polling result - %s ", result)
|
||||
}
|
||||
|
||||
func agentIdentifier() string {
|
||||
|
|
Loading…
Reference in New Issue
Block a user