You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2016/04/25 18:56:12 UTC

[7/9] couchdb commit: updated refs/heads/master to 01edf89

Improve wait/retry


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

Branch: refs/heads/master
Commit: 1ae2c75bfc10e9fcca23ca995a7802414a39de39
Parents: 334eeee
Author: sebastianro <se...@apache.org>
Authored: Sat Apr 23 19:59:07 2016 +0200
Committer: sebastianro <se...@apache.org>
Committed: Sat Apr 23 19:59:07 2016 +0200

----------------------------------------------------------------------
 test/javascript/couch_test_runner.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/1ae2c75b/test/javascript/couch_test_runner.js
----------------------------------------------------------------------
diff --git a/test/javascript/couch_test_runner.js b/test/javascript/couch_test_runner.js
index 1d53255..887e988 100644
--- a/test/javascript/couch_test_runner.js
+++ b/test/javascript/couch_test_runner.js
@@ -486,13 +486,19 @@ function get_random_db_name() {
 
 // for Heisenbug-prone spots: retry n times (e.g. quora not met immediately)
 // if the problem still persists afterwards, we need sth else (similar to e.g. webdriver)
-function retry_part(fct, n) {
+function retry_part(fct, n, duration) {
   n = n || 3;
+  duration = (duration == undefined ? 100 : duration);
   for(var i=1; i<=n; i++){
     try {
       return fct();
     }catch(e){
       if(i<n){
+        // wait
+        var b4 = (new Date()).getTime();
+        // if this is too bad, we could GET /
+        // or in fact get _changes w/ longpoll on _users or so
+        while(((new Date()).getTime() - b4) < duration) {}
         continue;
       }else{
         throw e;