data_sender

This commit is contained in:
insanity@loafle.com 2017-04-28 13:16:53 +09:00
parent 26f82a78b0
commit c1ca0aa45c

View File

@ -16,7 +16,6 @@ import (
) )
const ( const (
CENTRAL_ADDR = "127.0.0.1:50052"
FILE_PATH = "/overflow/tmp/data.tmp" FILE_PATH = "/overflow/tmp/data.tmp"
DEFAULT_INTERVAL = 10 DEFAULT_INTERVAL = 10
) )
@ -77,7 +76,7 @@ func (ds *DataSender) start() {
}) })
} }
func (ds *DataSender) Stop() { func (ds *DataSender) Stop() {
observer.Notify(messages.DATA_SENDER_STOPPED, true)
} }
func (ds *DataSender) handleData(qc chan interface{}) { func (ds *DataSender) handleData(qc chan interface{}) {
@ -99,7 +98,8 @@ func (ds *DataSender) send(data []*Data) {
ds.addFailedData(data) ds.addFailedData(data)
conn, err := grpc.Dial(CENTRAL_ADDR, grpc.WithInsecure()) addr := ds.gconf.Central.Address + ":" + string(ds.gconf.Central.Port)
conn, err := grpc.Dial(addr, grpc.WithInsecure())
if err != nil { if err != nil {
ds.saveFailedData(data) ds.saveFailedData(data)
return return