diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/benchmarks/test_blobs_sqlite_backend.py | 8 | ||||
-rw-r--r-- | tests/benchmarks/test_blobs_upload_download.py | 20 |
2 files changed, 7 insertions, 21 deletions
diff --git a/tests/benchmarks/test_blobs_sqlite_backend.py b/tests/benchmarks/test_blobs_sqlite_backend.py index 8c6caa66..7dd51360 100644 --- a/tests/benchmarks/test_blobs_sqlite_backend.py +++ b/tests/benchmarks/test_blobs_sqlite_backend.py @@ -5,14 +5,10 @@ from uuid import uuid4 from io import BytesIO from twisted.internet.defer import gatherResults -from twisted.internet.defer import DeferredSemaphore from leap.soledad.client._db.blobs import SQLiteBlobBackend -semaphore = DeferredSemaphore(2) - - # # put # @@ -23,7 +19,7 @@ def put(backend, amount, data): blob_id = uuid4().hex fd = BytesIO(data) size = len(data) - d = semaphore.run(backend.put, blob_id, fd, size) + d = backend.put(blob_id, fd, size) deferreds.append(d) return gatherResults(deferreds) @@ -51,7 +47,7 @@ test_sqlite_blobs_backend_put_1000_10k = create_put_test(1000, 10 * 1000) # -# put +# get # @pytest.inlineCallbacks diff --git a/tests/benchmarks/test_blobs_upload_download.py b/tests/benchmarks/test_blobs_upload_download.py index 1ec524dc..4489842a 100644 --- a/tests/benchmarks/test_blobs_upload_download.py +++ b/tests/benchmarks/test_blobs_upload_download.py @@ -8,7 +8,6 @@ from io import BytesIO from twisted.internet.defer import gatherResults from twisted.internet.defer import returnValue -from twisted.internet.defer import DeferredSemaphore from leap.soledad.client._db.blobs import BlobDoc @@ -20,10 +19,6 @@ def payload(size): return base64.b64encode(payload_bytes)[:size] # remove b64 overhead -# used to limit the amount of concurrent accesses to the blob manager -semaphore = DeferredSemaphore(2) - - def reclaim_free_space(client): return client.blobmanager.local.dbpool.runQuery("VACUUM") @@ -38,8 +33,7 @@ def load_up_downloads(client, amount, data): ids = yield client.blobmanager.remote_list(namespace='payload') deferreds = [] for blob_id in ids: - d = semaphore.run( - client.blobmanager.delete, blob_id, namespace='payload') + d = client.blobmanager.delete(blob_id, namespace='payload') deferreds.append(d) yield gatherResults(deferreds) @@ -49,8 +43,7 @@ def load_up_downloads(client, amount, data): fd = BytesIO(data) doc = BlobDoc(fd, blob_id=uuid.uuid4().hex) size = sys.getsizeof(fd) - d = semaphore.run( - client.blobmanager.put, doc, size, namespace='payload') + d = client.blobmanager.put(doc, size, namespace='payload') deferreds.append(d) yield gatherResults(deferreds) @@ -59,8 +52,7 @@ def load_up_downloads(client, amount, data): def download_blobs(client, pending): deferreds = [] for item in pending: - d = semaphore.run( - client.blobmanager.get, item, namespace='payload') + d = client.blobmanager.get(item, namespace='payload') deferreds.append(d) yield gatherResults(deferreds) @@ -114,8 +106,7 @@ def load_up_uploads(client, amount, data): ids = yield client.blobmanager.remote_list(namespace='payload') deferreds = [] for blob_id in ids: - d = semaphore.run( - client.blobmanager.delete, blob_id, namespace='payload') + d = client.blobmanager.delete(blob_id, namespace='payload') deferreds.append(d) yield gatherResults(deferreds) @@ -127,8 +118,7 @@ def upload_blobs(client, amount, data): fd = BytesIO(data) doc = BlobDoc(fd, blob_id=uuid.uuid4().hex) size = sys.getsizeof(fd) - d = semaphore.run( - client.blobmanager.put, doc, size, namespace='payload') + d = client.blobmanager.put(doc, size, namespace='payload') deferreds.append(d) yield gatherResults(deferreds) |