From 0e38e1ba0b4df4e65b60ed45ed9a6638bcda44c1 Mon Sep 17 00:00:00 2001 From: wahidw Date: Tue, 18 Feb 2020 18:20:55 +0000 Subject: [PATCH] RIC-3057: Fix for retry in socket send Change-Id: I96ba72a59cb23af6148566b7b54d30d85e627138 Signed-off-by: wahidw --- RELNOTES | 3 +++ container-tag.yaml | 2 +- pkg/sbi/nngpush.go | 19 ++++++++++++------- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/RELNOTES b/RELNOTES index 8bcf0f8..b497112 100644 --- a/RELNOTES +++ b/RELNOTES @@ -1,3 +1,6 @@ +### v0.4.15 +* Retained (E2M->E2T issue) - retrying when is_Ready flag in socket handle is false + ### v0.4.14 * Restart/Start of RM, fetch E2T data from E2manager - implementation in RM for v1/e2t/list API handling diff --git a/container-tag.yaml b/container-tag.yaml index 6b9814a..c754d3c 100644 --- a/container-tag.yaml +++ b/container-tag.yaml @@ -2,4 +2,4 @@ # By default this file is in the docker build directory, # but the location can configured in the JJB template. --- -tag: 0.4.14 +tag: 0.4.15 diff --git a/pkg/sbi/nngpush.go b/pkg/sbi/nngpush.go index 1404319..b270abf 100644 --- a/pkg/sbi/nngpush.go +++ b/pkg/sbi/nngpush.go @@ -50,14 +50,13 @@ import ( _ "nanomsg.org/go/mangos/v2/transport/all" "routing-manager/pkg/rtmgr" "strconv" + "time" ) - - type NngPush struct { Sbi NewSocket CreateNewNngSocketHandler - rcChan chan *xapp.RMRParams + rcChan chan *xapp.RMRParams } func NewNngPush() *NngPush { @@ -150,10 +149,16 @@ func (c *NngPush) DistributeAll(policies *[]string) error { xapp.Logger.Debug("Invoked: sbi.DistributeAll") xapp.Logger.Debug("args: %v", *policies) for _, ep := range rtmgr.Eps { - if ep.IsReady { - go c.send(ep, policies) - } else { - xapp.Logger.Warn("Endpoint " + ep.Uuid + " is not ready") + i := 1 + for i < 5 { + if ep.IsReady { + go c.send(ep, policies) + break + } else { + xapp.Logger.Warn("Endpoint " + ep.Uuid + " is not ready" + " Retry count " + strconv.Itoa(i)) + time.Sleep(10 * time.Millisecond) + i++ + } } } return nil -- 2.16.6