This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git


The following commit(s) were added to refs/heads/master by this push:
     new c5750468c2 [FIX] Run blobIdProvider out of driver threads (#2544)
c5750468c2 is described below

commit c5750468c2b352118d8e13f4355a49b95e25f018
Author: Benoit TELLIER <[email protected]>
AuthorDate: Wed Dec 4 23:29:50 2024 +0100

    [FIX] Run blobIdProvider out of driver threads (#2544)
    
    Potentially long operations...
---
 .../server/blob/deduplication/DeDuplicationBlobStore.scala    | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git 
a/server/blob/blob-storage-strategy/src/main/scala/org/apache/james/server/blob/deduplication/DeDuplicationBlobStore.scala
 
b/server/blob/blob-storage-strategy/src/main/scala/org/apache/james/server/blob/deduplication/DeDuplicationBlobStore.scala
index ace4cd5510..dda70bf4c3 100644
--- 
a/server/blob/blob-storage-strategy/src/main/scala/org/apache/james/server/blob/deduplication/DeDuplicationBlobStore.scala
+++ 
b/server/blob/blob-storage-strategy/src/main/scala/org/apache/james/server/blob/deduplication/DeDuplicationBlobStore.scala
@@ -124,11 +124,12 @@ class DeDuplicationBlobStore @Inject()(blobStoreDAO: 
BlobStoreDAO,
       .map(blobIdFactory.of)
       .map(blobId => Tuples.of(blobId, data))
 
-  private def withBlobIdFromArray: BlobIdProvider[Array[Byte]] = data => {
-    val code = Hashing.sha256.hashBytes(data)
-    val blobId = blobIdFactory.of(base64(code))
-    Mono.just(Tuples.of(blobId, data))
-  }
+  private def withBlobIdFromArray: BlobIdProvider[Array[Byte]] = data =>
+    SMono.fromCallable(() => {
+      val code = Hashing.sha256.hashBytes(data)
+      val blobId = blobIdFactory.of(base64(code))
+      Tuples.of(blobId, data)
+    }).subscribeOn(Schedulers.parallel())
 
   private def base64(hashCode: HashCode) = {
     val bytes = hashCode.asBytes


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to