From 03ec23ec19c5b1b9b865f26c6680a5327706a6c8 Mon Sep 17 00:00:00 2001 From: Paul Joseph Davis Date: Wed, 25 Nov 2009 22:39:23 +0000 Subject: Fixed a bug preventing active_dbs from working. Thanks Jeff Macdonald for the report. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@884315 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/test/stats.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'share/www/script') diff --git a/share/www/script/test/stats.js b/share/www/script/test/stats.js index cf2581e9..6e37e741 100644 --- a/share/www/script/test/stats.js +++ b/share/www/script/test/stats.js @@ -80,9 +80,24 @@ couchTests.stats = function(debug) { var testFun = function() { var pre_dbs = getStat("couchdb", "open_databases").current || 0; var pre_files = getStat("couchdb", "open_os_files").current || 0; - + + // We have to make sure that as we open the max'th database + // that we've waited for more than 1 second since opening + // the first database so that any delayed commits will be + // flushed. + var times = []; for(var i = 0; i < max*2; i++) { - newDb("test_suite_db_" + i, true); + if(i >= max) { + var msecs = (new Date()).getTime() - times[i-max]; + if(msecs < 1000) { + CouchDB.request("GET", "/_sleep?time=" + (msecs+250)); + } + } + db = newDb("test_suite_db_" + i, true); + times.push((new Date()).getTime()); + + // Trigger a delayed commit + db.save({_id: "" + i, "lang": "Awesome!"}); } var open_dbs = getStat("couchdb", "open_databases").current; -- cgit v1.2.3