evt commit

This commit is contained in:
geek 2017-05-16 17:25:55 +09:00
parent 0d1867caf7
commit 52da0187c7

View File

@ -9,6 +9,7 @@ import (
"log"
"reflect"
"sync"
"loafle.com/overflow/agent_api/messages"
)
var (
@ -107,7 +108,7 @@ func (es *EventSender) stop() {
func (es *EventSender) checkQueue() {
result := make([]*Data, 0)
result := make([]*messages.Event, 0)
for sc := range es.sc {
items := reflect.ValueOf(sc)
@ -118,9 +119,9 @@ func (es *EventSender) checkQueue() {
for i := 0; i < items.Len(); i++ {
item := items.Index(i).Elem().Interface()
tempCollectedData := item.(q.Item)
collectedData := tempCollectedData.Value.(*Data)
collectedData.AgentId = agentIdentifier()
result = append(result, collectedData)
collectedData := tempCollectedData.Value.(messages.Event)
//collectedData.AgentId = agentIdentifier()
result = append(result, &collectedData)
//log.Println("Result Len: ", len(result))
}
es.send(result)
@ -129,7 +130,7 @@ func (es *EventSender) checkQueue() {
}
func (es *EventSender) send(data []*Data) {
func (es *EventSender) send(data []*messages.Event) {
log.Println("Send Started")
conn, err := grpc.Dial(CENTRAL_ADDR, grpc.WithInsecure())