summaryrefslogtreecommitdiff
path: root/share/www/script/couch_tests.js
diff options
context:
space:
mode:
Diffstat (limited to 'share/www/script/couch_tests.js')
-rw-r--r--share/www/script/couch_tests.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/share/www/script/couch_tests.js b/share/www/script/couch_tests.js
index 85d07065..3978d483 100644
--- a/share/www/script/couch_tests.js
+++ b/share/www/script/couch_tests.js
@@ -149,6 +149,25 @@ function stringFun(fun) {
return string;
}
+function waitForRestart() {
+ var waiting = true;
+ while (waiting) {
+ try {
+ CouchDB.request("GET", "/");
+ CouchDB.request("GET", "/");
+ waiting = false;
+ } catch(e) {
+ // the request will fail until restart completes
+ }
+ }
+};
+
function restartServer() {
- CouchDB.request("POST", "/_restart");
+ var xhr;
+ try {
+ CouchDB.request("POST", "/_restart");
+ } catch(e) {
+ // this request may sometimes fail
+ }
+ waitForRestart();
}