Repository: kudu
Updated Branches:
  refs/heads/master a6d7a5c6d -> ad2fd4c69


[util] Fix a minor bug in AssertEventually()

We want to be sleeping with a monotonically increasing timeout
value in this routine. After 10 attempts, we sleep
for 1000 ms(constant value). But this routine was never
increasing the 'attempts' thus falling back to sleep always at 1ms
intervals making it inefficient.

Change-Id: Id34b3461164d96261e4a2d1657244332eb33ad0c
Reviewed-on: http://gerrit.cloudera.org:8080/4566
Tested-by: Kudu Jenkins
Reviewed-by: Adar Dembo <[email protected]>
Reviewed-by: Mike Percy <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/ad2fd4c6
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/ad2fd4c6
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/ad2fd4c6

Branch: refs/heads/master
Commit: ad2fd4c69f3dccbac232f5d40a45389556c4a7a1
Parents: a6d7a5c
Author: Dinesh Bhat <[email protected]>
Authored: Mon Oct 3 00:55:09 2016 -0700
Committer: Mike Percy <[email protected]>
Committed: Mon Oct 3 11:55:40 2016 +0000

----------------------------------------------------------------------
 src/kudu/util/test_util.cc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/ad2fd4c6/src/kudu/util/test_util.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/test_util.cc b/src/kudu/util/test_util.cc
index b002d43..1b8ca92 100644
--- a/src/kudu/util/test_util.cc
+++ b/src/kudu/util/test_util.cc
@@ -184,9 +184,8 @@ string GetTestDataDirectory() {
 void AssertEventually(const std::function<void(void)>& f,
                       const MonoDelta& timeout) {
   const MonoTime deadline = MonoTime::Now() + timeout;
-  int attempts = 0;
 
-  while (MonoTime::Now() < deadline) {
+  for (int attempts = 0; MonoTime::Now() < deadline; attempts++) {
     // Capture any assertion failures within this scope (i.e. from their 
function)
     // into 'results'
     testing::TestPartResultArray results;

Reply via email to