couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woh...@apache.org
Subject [couchdb] 09/19: use delay instead
Date Wed, 01 Nov 2017 00:01:36 GMT
This is an automated email from the ASF dual-hosted git repository.

wohali pushed a commit to branch 211-update-2
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 4efd5d57ecc24dc893aaf7b5349d081216afc009
Author: Tony Sun <tony.sun427@gmail.com>
AuthorDate: Fri Oct 27 10:43:58 2017 -0700

    use delay instead
---
 src/mango/test/mango.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/mango/test/mango.py b/src/mango/test/mango.py
index 1ed2a2c..dd58e74 100644
--- a/src/mango/test/mango.py
+++ b/src/mango/test/mango.py
@@ -33,6 +33,11 @@ def get_from_environment(key, default):
     value = os.environ.get(key)
     return value if value is not None else default
 
+# add delay functionality
+def delay(n=5, t=0.2):
+    for i in range(0, n):
+        time.sleep(t)
+
 
 class Database(object):
     def __init__(self, dbname,
@@ -77,9 +82,9 @@ class Database(object):
 
     def recreate(self):
         self.delete()
-        time.sleep(1)
+        delay()
         self.create()
-        time.sleep(1)
+        delay()
 
     def save_doc(self, doc):
         self.save_docs([doc])
@@ -166,13 +171,14 @@ class Database(object):
 
     def delete_index(self, ddocid, name, idx_type="json"):
         path = ["_index", ddocid, idx_type, name]
-        r = self.sess.delete(self.path(path), params={"w": "1"})
+        r = self.sess.delete(self.path(path), params={"w": "3"})
+        delay()
         r.raise_for_status()
 
     def bulk_delete(self, docs):
         body = {
             "docids" : docs,
-            "w": 1
+            "w": 3
         }
         body = json.dumps(body)
         r = self.sess.post(self.path("_index/_bulk_delete"), data=body)

-- 
To stop receiving notification emails like this one, please contact
"commits@couchdb.apache.org" <commits@couchdb.apache.org>.

Mime
View raw message