VOL-2850 Reworked RequestQueue so it no longer requires a separate thread.
Also removed start()/stop() functions, which are no longer needed.
Also changed to an unbounded queue (dequeue implementation).
Change-Id: I891dcf68b64c3a08088b6d10fa30dadb8eb6f28d
diff --git a/rw_core/core/device_agent.go b/rw_core/core/device_agent.go
index 1df4572..37a79c8 100755
--- a/rw_core/core/device_agent.go
+++ b/rw_core/core/device_agent.go
@@ -38,10 +38,6 @@
"google.golang.org/grpc/status"
)
-const (
- maxOrderedDeviceRequestQueueSize = 1000
-)
-
// DeviceAgent represents device agent attributes
type DeviceAgent struct {
deviceID string
@@ -81,7 +77,7 @@
agent.clusterDataProxy = cdProxy
agent.defaultTimeout = timeout
agent.device = proto.Clone(device).(*voltha.Device)
- agent.requestQueue = coreutils.NewRequestQueue(agent.deviceID, maxOrderedDeviceRequestQueueSize)
+ agent.requestQueue = coreutils.NewRequestQueue()
return &agent
}
@@ -102,10 +98,6 @@
}
}()
- // Start the request queue. If this start fails then stop will be invoked and it requires
- // that the request sequencer is present
- agent.requestQueue.Start()
-
var device *voltha.Device
if deviceToCreate == nil {
// Load the existing device
@@ -190,9 +182,6 @@
logger.Debugw("device-already-removed", log.Fields{"device-id": agent.deviceID})
}
- // Stop the request queue - no more requests can be processed
- agent.requestQueue.Stop()
-
close(agent.exitChannel)
agent.stopped = true