From 47a66980075f2bb0fe3a4e581f7c7260777dd81c Mon Sep 17 00:00:00 2001 From: geek Date: Fri, 28 Apr 2017 18:39:11 +0900 Subject: [PATCH] event test --- event_sender.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/event_sender.go b/event_sender.go index 714f341..d1aa8d4 100644 --- a/event_sender.go +++ b/event_sender.go @@ -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() {