Hi Gary,

shouldn't we retry on SA_AIS_ERR_TRY_AGAIN? With the SA_AIS_ERR_TIMEOUT code 
the operation may have

been executed, failed or is ongoing.

/Hans


On 09/18/2017 02:15 AM, Gary Lee wrote:
Sometimes immutil_saImmOmAccessorGet_o2 returns TIMEOUT,
AMF should retry a few times.
---
  src/amf/amfnd/util.cc | 10 ++++++++++
  1 file changed, 10 insertions(+)

diff --git a/src/amf/amfnd/util.cc b/src/amf/amfnd/util.cc
index bca642eac..a41fc338f 100644
--- a/src/amf/amfnd/util.cc
+++ b/src/amf/amfnd/util.cc
@@ -359,10 +359,20 @@ SaAisErrorT amf_saImmOmAccessorGet_o2(SaImmHandleT 
&immHandle,
                                        const std::string &objectName,
                                        const SaImmAttrNameT *attributeNames,
                                        SaImmAttrValuesT_2 ***attributes) {
+  unsigned int nTries = 1;
+
    // note: this will handle SA_AIS_ERR_BAD_HANDLE just once
    SaAisErrorT rc = immutil_saImmOmAccessorGet_o2(
        accessorHandle, objectName.c_str(), attributeNames, attributes);
+ while (rc == SA_AIS_ERR_TIMEOUT &&
+    nTries < immutilWrapperProfile.nTries) {
+    usleep(immutilWrapperProfile.retryInterval * 1000);
+    rc = immutil_saImmOmAccessorGet_o2(
+      accessorHandle, objectName.c_str(), attributeNames, attributes);
+    nTries++;
+  }
+
    if (rc == SA_AIS_ERR_BAD_HANDLE) {
      immutil_saImmOmAccessorFinalize(accessorHandle);
      immutil_saImmOmFinalize(immHandle);


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to