Fix "config too large" crash (#1077)

* Catch config push exceptions

* Tidied up
pull/1713/head
SessionHero01 4 weeks ago committed by GitHub
parent 49c7f18ca2
commit ddfda91fb5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -208,11 +208,15 @@ class ConfigUploader @Inject constructor(
// Gather data to push // Gather data to push
groupConfigAccess { configs -> groupConfigAccess { configs ->
if (configs.groupMembers.needsPush()) { if (configs.groupMembers.needsPush()) {
membersPush = configs.groupMembers.push() membersPush = runCatching { configs.groupMembers.push() }
.onFailure { Log.w(TAG, "Error generating group members config push", it) }
.getOrNull()
} }
if (configs.groupInfo.needsPush()) { if (configs.groupInfo.needsPush()) {
infoPush = configs.groupInfo.push() infoPush = runCatching { configs.groupInfo.push() }
.onFailure { Log.w(TAG, "Error generating group info config push", it) }
.getOrNull()
} }
keysPush = configs.groupKeys.pendingConfig() keysPush = configs.groupKeys.pendingConfig()
@ -338,7 +342,12 @@ class ConfigUploader @Inject constructor(
return@mapNotNull null return@mapNotNull null
} }
type to config.push() val configPush = runCatching { config.push() }
.onFailure { Log.w(TAG, "Error generating $type config", it) }
.getOrNull()
?: return@mapNotNull null
type to configPush
} }
} }
@ -352,17 +361,17 @@ class ConfigUploader @Inject constructor(
val pushTasks = pushes.map { (configType, configPush) -> val pushTasks = pushes.map { (configType, configPush) ->
async { async {
(configType to configPush) to pushConfig( Triple(configType, configPush, pushConfig(
userAuth, userAuth,
snode, snode,
configPush, configPush,
configType.namespace configType.namespace
) ))
} }
} }
val pushResults = val pushResults =
pushTasks.awaitAll().associate { it.first.first to (it.first.second to it.second) } pushTasks.awaitAll().associate { (configType, push, result) -> configType to (push to result) }
Log.d(TAG, "Pushed ${pushResults.size} user configs") Log.d(TAG, "Pushed ${pushResults.size} user configs")

@ -53,7 +53,7 @@ dependencies {
ksp("com.google.dagger:hilt-compiler:$daggerHiltVersion") ksp("com.google.dagger:hilt-compiler:$daggerHiltVersion")
ksp("androidx.hilt:hilt-compiler:$jetpackHiltVersion") ksp("androidx.hilt:hilt-compiler:$jetpackHiltVersion")
api 'org.sessionfoundation:libsession-util-android:1.0.2' api 'org.sessionfoundation:libsession-util-android:1.0.3'
implementation "net.java.dev.jna:jna:5.12.1@aar" implementation "net.java.dev.jna:jna:5.12.1@aar"
implementation "androidx.core:core-ktx:$coreVersion" implementation "androidx.core:core-ktx:$coreVersion"

Loading…
Cancel
Save