[VOL-4514] Addressing device reconciliation failure
See comments on https://jira.opencord.org/browse/VOL-4514
This change is dependent on the related proto and voltha lib go
changes to be merged first. Until then jenkins will fail.
Change-Id: I8d99c3619d630677d402b9fb4b4f0bc22dd9a9f0
diff --git a/rw_core/core/device/agent.go b/rw_core/core/device/agent.go
index 1adf88c..2c69b28 100755
--- a/rw_core/core/device/agent.go
+++ b/rw_core/core/device/agent.go
@@ -1367,11 +1367,15 @@
if err := agent.requestQueue.WaitForGreenLight(ctx); err != nil {
return err
}
+ logger.Infow(ctx, "aborting-current-running-requests-after-wait", log.Fields{"device-id": agent.deviceID})
+
defer agent.requestQueue.RequestComplete()
// If any reconciling is in progress just abort it. The adapter is gone.
agent.stopReconcile()
+ logger.Infow(ctx, "aborting-current-running-requests-after-sendstop", log.Fields{"device-id": agent.deviceID})
+
// Update the Core device transient state accordingly
var updatedState core.DeviceTransientState_Types
switch agent.getTransientState() {
@@ -1515,7 +1519,7 @@
//making here to keep lifecycle of this channel within the scope of retryReconcile
agent.stopReconcilingMutex.Lock()
- agent.stopReconciling = make(chan int)
+ agent.stopReconciling = make(chan int, 1)
agent.stopReconcilingMutex.Unlock()
// defined outside the retry loop so it can be cleaned
@@ -1591,6 +1595,8 @@
break retry
}
+ logger.Debugw(ctx, "reconcile-retry-ends", log.Fields{"adapter-endpoint": agent.adapterEndpoint})
+
// Retry loop is broken, so stop any timers and drain the channel
if backoffTimer != nil && !backoffTimer.Stop() {