From 5ac7a9eb199315cfb854996a3687eb26293aea00 Mon Sep 17 00:00:00 2001 From: Adrien Beraud <adrien.beraud@savoirfairelinux.com> Date: Thu, 6 Feb 2025 14:35:13 -0500 Subject: [PATCH] gitserver: run fetch callback on thread pool GitLab: #1104 Change-Id: I8d5c0a1fdb2f9bfc84f442e1323216ae3100da6d --- src/jamidht/jamiaccount.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp index 60eaea9e3..d52fc3157 100644 --- a/src/jamidht/jamiaccount.cpp +++ b/src/jamidht/jamiaccount.cpp @@ -2094,16 +2094,17 @@ JamiAccount::doRegister_() syncCnt_.fetch_add(1); gs->setOnFetched( [w = weak(), conversationId, deviceId](const std::string& commit) { - if (auto shared = w.lock()) { - shared->convModule()->setFetched(conversationId, - deviceId.toString(), - commit); - shared->syncCnt_.fetch_sub(1); - if (shared->syncCnt_.load() == 0) { - emitSignal<libjami::ConversationSignal::ConversationCloned>( - shared->getAccountID().c_str()); + dht::ThreadPool::computation().run([w, conversationId, deviceId, commit]() { + if (auto shared = w.lock()) { + shared->convModule()->setFetched(conversationId, + deviceId.toString(), + commit); + if (shared->syncCnt_.fetch_sub(1) == 1) { + emitSignal<libjami::ConversationSignal::ConversationCloned>( + shared->getAccountID().c_str()); + } } - } + }); }); const dht::Value::Id serverId = ValueIdDist()(rand); { -- GitLab