VOL-3734 optimise rpc events to be send to queue and then to kafka from the queue
Change-Id: I5e068722412b6d9526760900d9173aaf51e00946
diff --git a/rw_core/core/device/agent.go b/rw_core/core/device/agent.go
index 7e401aa..89fcc51 100755
--- a/rw_core/core/device/agent.go
+++ b/rw_core/core/device/agent.go
@@ -300,8 +300,8 @@
var rpce *voltha.RPCEvent
defer func() {
if rpce != nil {
- go agent.deviceMgr.SendRPCEvent(ctx, "RPC_ERROR_RAISE_EVENT", rpce,
- voltha.EventCategory_COMMUNICATION, nil, time.Now().UnixNano())
+ agent.deviceMgr.SendRPCEvent(ctx, "RPC_ERROR_RAISE_EVENT", rpce,
+ voltha.EventCategory_COMMUNICATION, nil, time.Now().Unix())
}
}()
select {
@@ -338,8 +338,8 @@
var rpce *voltha.RPCEvent
defer func() {
if rpce != nil {
- go agent.deviceMgr.SendRPCEvent(ctx, "RPC_ERROR_RAISE_EVENT", rpce,
- voltha.EventCategory_COMMUNICATION, nil, time.Now().UnixNano())
+ agent.deviceMgr.SendRPCEvent(ctx, "RPC_ERROR_RAISE_EVENT", rpce,
+ voltha.EventCategory_COMMUNICATION, nil, time.Now().Unix())
}
}()
@@ -473,8 +473,8 @@
var rpce *voltha.RPCEvent
defer func() {
if rpce != nil {
- go agent.deviceMgr.SendRPCEvent(ctx, "RPC_ERROR_RAISE_EVENT", rpce,
- voltha.EventCategory_COMMUNICATION, nil, time.Now().UnixNano())
+ agent.deviceMgr.SendRPCEvent(ctx, "RPC_ERROR_RAISE_EVENT", rpce,
+ voltha.EventCategory_COMMUNICATION, nil, time.Now().Unix())
}
}()
select {
@@ -960,8 +960,8 @@
logger.Errorw(ctx, "failed-process-transition", log.Fields{"device-id": device.Id, "previous-admin-state": prevDevice.AdminState, "current-admin-state": device.AdminState})
// Sending RPC EVENT here
rpce := agent.deviceMgr.NewRPCEvent(ctx, agent.deviceID, err.Error(), nil)
- go agent.deviceMgr.SendRPCEvent(ctx, "RPC_ERROR_RAISE_EVENT", rpce, voltha.EventCategory_COMMUNICATION,
- nil, time.Now().UnixNano())
+ agent.deviceMgr.SendRPCEvent(ctx, "RPC_ERROR_RAISE_EVENT", rpce, voltha.EventCategory_COMMUNICATION,
+ nil, time.Now().Unix())
}
return nil
@@ -1005,8 +1005,8 @@
logger.Errorw(ctx, "failed-process-transition", log.Fields{"device-id": device.Id, "previous-admin-state": prevDevice.AdminState, "current-admin-state": device.AdminState})
// Sending RPC EVENT here
rpce := agent.deviceMgr.NewRPCEvent(ctx, agent.deviceID, err.Error(), nil)
- go agent.deviceMgr.SendRPCEvent(ctx, "RPC_ERROR_RAISE_EVENT", rpce, voltha.EventCategory_COMMUNICATION,
- nil, time.Now().UnixNano())
+ agent.deviceMgr.SendRPCEvent(ctx, "RPC_ERROR_RAISE_EVENT", rpce, voltha.EventCategory_COMMUNICATION,
+ nil, time.Now().Unix())
}
return nil
}