[VOL-5428] - fix race condition while sending reconciling flows finished signal
Change-Id: I89886f78be34d20867f7ae6996ba1199b03c62d4
Signed-off-by: Sridhar Ravindra <sridhar.ravindra@radisys.com>
diff --git a/VERSION b/VERSION
index 719c84e..e9548af 100755
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.12.14
+2.12.15
diff --git a/internal/pkg/mib/onu_device_entry.go b/internal/pkg/mib/onu_device_entry.go
index 6398e0a..108a706 100755
--- a/internal/pkg/mib/onu_device_entry.go
+++ b/internal/pkg/mib/onu_device_entry.go
@@ -135,6 +135,8 @@
const cEmptyEquipIDString = "EMPTY_EQUIP_ID"
const cNotPresentEquipIDString = "NOT_PRESENT_EQUIP_ID"
+const vlanConfigSendChanExpiry = 5
+
type uniPersConfig struct {
PersUniID uint8 `json:"uni_id"`
PersTpPathMap map[uint8]string `json:"PersTpPathMap"` // tp-id to tp-path map
@@ -984,12 +986,13 @@
// SendChReconcilingFlowsFinished - TODO: add comment
func (oo *OnuDeviceEntry) SendChReconcilingFlowsFinished(ctx context.Context, value bool) {
if oo != nil { //if the object still exists (might have been already deleted in background)
- //use asynchronous channel sending to avoid stucking on non-waiting receiver
+ // wait for some time before exiting, as the receiver might not have started and will lead to Mib reset if this signal is missed
+ expiry := vlanConfigSendChanExpiry * time.Second
select {
case oo.chReconcilingFlowsFinished <- value:
logger.Info(ctx, "reconciling - flows finished sent", log.Fields{"device-id": oo.deviceID})
- default:
- logger.Infow(ctx, "reconciling - flows finished not sent!", log.Fields{"device-id": oo.deviceID})
+ case <-time.After(expiry):
+ logger.Infow(ctx, "reconciling - timer expired, flows finished not sent!", log.Fields{"device-id": oo.deviceID})
}
}
}