summaryrefslogtreecommitdiff
path: root/src/leap/soledad
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2017-10-11 11:20:22 -0300
committerdrebs <drebs@riseup.net>2017-10-12 12:06:33 -0300
commit07f94a9a6f281069a0441cafce3f8a92e6d03e8b (patch)
tree6744c96d2dd52b3c28ae45f64323cde7178e5631 /src/leap/soledad
parent1cde86239f68ca8fa896ecf4ffc6b891eeb837e3 (diff)
[feature] make concurrent blob writes configurable
Diffstat (limited to 'src/leap/soledad')
-rw-r--r--src/leap/soledad/server/_blobs.py5
-rw-r--r--src/leap/soledad/server/_config.py1
-rw-r--r--src/leap/soledad/server/auth.py7
3 files changed, 9 insertions, 4 deletions
diff --git a/src/leap/soledad/server/_blobs.py b/src/leap/soledad/server/_blobs.py
index cd47098d..22277fc4 100644
--- a/src/leap/soledad/server/_blobs.py
+++ b/src/leap/soledad/server/_blobs.py
@@ -62,9 +62,10 @@ VALID_STRINGS = re.compile('^[a-zA-Z0-9_-]+$')
@implementer(interfaces.IIncomingBoxBackend)
class FilesystemBlobsBackend(object):
- def __init__(self, blobs_path='/tmp/blobs/', quota=200 * 1024):
+ def __init__(self, blobs_path='/tmp/blobs/', quota=200 * 1024,
+ concurrent_writes=50):
self.quota = quota
- self.semaphore = defer.DeferredSemaphore(50) # TODO: make configurable
+ self.semaphore = defer.DeferredSemaphore(concurrent_writes)
if not os.path.isdir(blobs_path):
os.makedirs(blobs_path)
self.path = blobs_path
diff --git a/src/leap/soledad/server/_config.py b/src/leap/soledad/server/_config.py
index c23f1eae..0d37879e 100644
--- a/src/leap/soledad/server/_config.py
+++ b/src/leap/soledad/server/_config.py
@@ -33,6 +33,7 @@ CONFIG_DEFAULTS = {
'blobs': False,
'blobs_path': '/var/lib/soledad/blobs',
'services_tokens_file': '/etc/soledad/services.tokens',
+ 'concurrent_blob_writes': 50,
},
'database-security': {
'members': ['soledad'],
diff --git a/src/leap/soledad/server/auth.py b/src/leap/soledad/server/auth.py
index da13dc8c..39eb09f6 100644
--- a/src/leap/soledad/server/auth.py
+++ b/src/leap/soledad/server/auth.py
@@ -56,8 +56,11 @@ class SoledadRealm(object):
if conf is None:
conf = get_config()
blobs = conf['blobs']
- blobs_resource = BlobsResource("filesystem",
- conf['blobs_path']) if blobs else None
+ concurrent_writes = conf['concurrent_blob_writes']
+ blobs_resource = BlobsResource(
+ "filesystem",
+ conf['blobs_path'],
+ concurrent_writes=concurrent_writes) if blobs else None
self.anon_resource = AnonymousResource(
enable_blobs=blobs)
self.auth_resource = PublicResource(