summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/changes/bug_5449_add-workaround-for-hanging-requests-after-multipart-put1
-rw-r--r--common/src/leap/soledad/common/couch.py10
-rw-r--r--scripts/profiling/sync/sync-many.py2
3 files changed, 12 insertions, 1 deletions
diff --git a/common/changes/bug_5449_add-workaround-for-hanging-requests-after-multipart-put b/common/changes/bug_5449_add-workaround-for-hanging-requests-after-multipart-put
new file mode 100644
index 00000000..dece564a
--- /dev/null
+++ b/common/changes/bug_5449_add-workaround-for-hanging-requests-after-multipart-put
@@ -0,0 +1 @@
+ o Renew HTTP session after multipart PUTs to avoid request hanging (#5449).
diff --git a/common/src/leap/soledad/common/couch.py b/common/src/leap/soledad/common/couch.py
index ebe8477f..1bb84985 100644
--- a/common/src/leap/soledad/common/couch.py
+++ b/common/src/leap/soledad/common/couch.py
@@ -855,6 +855,7 @@ class CouchDatabase(CommonBackend):
try:
self._database.resource.put_json(
doc.doc_id, body=buf.getvalue(), headers=envelope.headers)
+ self._renew_couch_session()
except ResourceConflict:
raise RevisionConflict()
@@ -1415,6 +1416,15 @@ class CouchDatabase(CommonBackend):
continue
yield t._doc
+ def _renew_couch_session(self):
+ """
+ Create a new couch connection session.
+
+ This is a workaround for #5448. Will not be needed once bigcouch is
+ merged with couchdb.
+ """
+ self._database.resource.session = Session(timeout=COUCH_TIMEOUT)
+
class CouchSyncTarget(CommonSyncTarget):
"""
diff --git a/scripts/profiling/sync/sync-many.py b/scripts/profiling/sync/sync-many.py
index 3666df2c..83793b0a 100644
--- a/scripts/profiling/sync/sync-many.py
+++ b/scripts/profiling/sync/sync-many.py
@@ -25,7 +25,7 @@ from client_side_db import get_soledad_instance
from leap.soledad.client import BootstrapSequenceError
-NUMBER_OF_REPLICAS = 5
+NUMBER_OF_REPLICAS = 1
DOCUMENTS_PER_REPLICA = 10