ack, review only. One comment/question below. /Regards HansN


On 12/20/2017 01:37 PM, Vu Minh Nguyen wrote:
Change interval time to 100 miliseconds, and timeout to one minute
for the default retry control.
---
  src/ais/tests/try_again_decorator_test.cc | 8 +++++---
  src/ais/try_again_decorator.h             | 8 ++++----
  2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/ais/tests/try_again_decorator_test.cc 
b/src/ais/tests/try_again_decorator_test.cc
index d8d4b34..bda6e36 100644
--- a/src/ais/tests/try_again_decorator_test.cc
+++ b/src/ais/tests/try_again_decorator_test.cc
@@ -31,13 +31,14 @@ extern "C" SaAisErrorT TestOtherMethod() {
    return (++test_counter % 2 ) ? SA_AIS_ERR_TRY_AGAIN : 
SA_AIS_ERR_UNAVAILABLE;
  }
+// This test case will take more than one minute!
  TEST(make_decorator, DefaultControl) {
-  // Default interval = 40ms, timeout = 10 * 1000ms
+  // Default interval = 100ms, timeout = 60 * 1000ms
    auto DecorTestMethod = ais::make_decorator(::TestMethod);
EXPECT_EQ(DecorTestMethod(), SA_AIS_ERR_TRY_AGAIN);
-  EXPECT_GE(test_counter, 200);
-  EXPECT_LE(test_counter, 250);
+  EXPECT_GE(test_counter, 400);
+  EXPECT_LE(test_counter, 601);
    test_counter = 0;
  }
@@ -47,6 +48,7 @@ class MyTryAgain {
      return (code != SA_AIS_ERR_TRY_AGAIN && code != SA_AIS_ERR_UNAVAILABLE);
    }
+ // The interval at leat should be 100ms, but this is just for testing.
    constexpr static uint64_t kIntervalMs = 10;
    constexpr static uint64_t kTimeoutMs  = 100;
  };
diff --git a/src/ais/try_again_decorator.h b/src/ais/try_again_decorator.h
index 8f8fdd9..dac6209 100644
--- a/src/ais/try_again_decorator.h
+++ b/src/ais/try_again_decorator.h
@@ -68,10 +68,10 @@ class DefaultRetryPolicy {
      return (code != SA_AIS_ERR_TRY_AGAIN);
    }
- // Sleep time between retries (ms)
-  constexpr static uint64_t kIntervalMs = 40;
-  // Timeout for the retry (ms)
-  constexpr static uint64_t kTimeoutMs  = 10 * 1000ull;
+  // Sleep time between retries (ms). Default is 100ms.
+  constexpr static uint64_t kIntervalMs = 100;
+  // Timeout for the retry (ms). Default is one minute.
+  constexpr static uint64_t kTimeoutMs  = 60 * 1000ull;
[HansN] is "ull" needed? (Uppercase is prefered, ULL).
  };
template <class T, class Policy = DefaultRetryPolicy> class Decorator;


------------------------------------------------------------------------------
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