event test

This commit is contained in:
geek 2017-04-28 18:39:11 +09:00
parent 618339b086
commit 47a6698007

View File

@ -3,16 +3,15 @@ package event_sender
import (
"context"
"google.golang.org/grpc"
"loafle.com/overflow/agent_api/observer"
"loafle.com/overflow/agent_api/observer/messages"
pb "loafle.com/overflow/crawler_go/grpc"
q "loafle.com/overflow/queue_go"
"log"
"reflect"
"loafle.com/overflow/agent_api/observer"
"sync"
)
var (
instance *EventSender
once sync.Once
@ -32,7 +31,6 @@ type Data struct {
FinishedAt uint64
}
func GetInstance() *EventSender {
once.Do(func() {
instance = &EventSender{}
@ -40,7 +38,7 @@ func GetInstance() *EventSender {
return instance
}
func init() {
func init() {
ch := make(chan interface{}, 0)
observer.Add(messages.CONFIGMANAGER_LOADED, ch)
handleInit(ch)
@ -58,9 +56,9 @@ func handleInit(ch chan interface{}) {
}
type EventSender struct {
once sync.Once
lq *q.LoafleQueue
sc chan interface{}
once sync.Once
lq *q.LoafleQueue
sc chan interface{}
}
func (es *EventSender) start() {