Skip to content

Commit aa2c8e8

Browse files
Tweak group polling concurrency (#1661)
1 parent 1da1df4 commit aa2c8e8

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

app/src/main/java/org/session/libsignal/utilities/HTTP.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ object HTTP {
162162
private val httpCallSemaphore = Semaphore(20)
163163

164164
private suspend fun Call.await(): Response {
165-
return withContext(Dispatchers.IO) {
166-
httpCallSemaphore.withPermit {
165+
return httpCallSemaphore.withPermit {
166+
withContext(Dispatchers.IO) {
167167
execute()
168168
}
169169
}

app/src/main/java/org/thoughtcrime/securesms/groups/GroupPoller.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ class GroupPoller @AssistedInject constructor(
226226
throw NonRetryableException("Group has been kicked")
227227
}
228228

229+
Log.v(TAG, "Start polling group($groupId) message snode = ${snode.ip}")
230+
229231
val adminKey = group.adminKey
230232

231233
val pollingTasks = mutableListOf<Pair<String, Deferred<*>>>()
@@ -270,7 +272,6 @@ class GroupPoller @AssistedInject constructor(
270272
Namespace.GROUP_MESSAGES()
271273
).orEmpty()
272274

273-
Log.v(TAG, "Retrieving group($groupId) message since lastHash = $lastHash, snode = ${snode.publicKeySet}")
274275

275276
SnodeAPI.sendBatchRequest(
276277
snode = snode,
@@ -356,6 +357,8 @@ class GroupPoller @AssistedInject constructor(
356357
}
357358
}
358359

360+
Log.d(TAG, "Group($groupId) polling completed, success = ${result.isSuccess}")
361+
359362
if (result.isFailure) {
360363
val error = result.exceptionOrNull()
361364
Log.e(TAG, "Error polling group", error)

app/src/main/java/org/thoughtcrime/securesms/groups/GroupPollerManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class GroupPollerManager @Inject constructor(
5858
pollFactory: GroupPoller.Factory,
5959
@param:ManagerScope private val managerScope: CoroutineScope,
6060
) : OnAppStartupComponent {
61-
private val groupPollerSemaphore = Semaphore(5)
61+
private val groupPollerSemaphore = Semaphore(20)
6262

6363
@Suppress("OPT_IN_USAGE")
6464
private val groupPollers: StateFlow<Map<AccountId, GroupPollerHandle>> =

0 commit comments

Comments
 (0)