Log errors

This commit is contained in:
Benoit Marty 2021-07-22 16:20:16 +02:00
parent 1d5ed46a49
commit ed0143c240

View file

@ -80,7 +80,7 @@ internal class OneTimeKeysUploader @Inject constructor(
val keyLimit = floor(maxOneTimeKeys / 2.0).toInt() val keyLimit = floor(maxOneTimeKeys / 2.0).toInt()
if (oneTimeKeyCount == null) { if (oneTimeKeyCount == null) {
// Ask the server how many otk he has // Ask the server how many otk he has
oneTimeKeyCount = fetchOtkNumber() oneTimeKeyCount = fetchOtkCount()
} }
val oneTimeKeyCountFromSync = oneTimeKeyCount val oneTimeKeyCountFromSync = oneTimeKeyCount
if (oneTimeKeyCountFromSync != null) { if (oneTimeKeyCountFromSync != null) {
@ -95,7 +95,7 @@ internal class OneTimeKeysUploader @Inject constructor(
// private keys clogging up our local storage. // private keys clogging up our local storage.
// So we need some kind of engineering compromise to balance all of // So we need some kind of engineering compromise to balance all of
// these factors. // these factors.
tryOrNull { tryOrNull("Unable to upload OTK") {
val uploadedKeys = uploadOTK(oneTimeKeyCountFromSync, keyLimit) val uploadedKeys = uploadOTK(oneTimeKeyCountFromSync, keyLimit)
Timber.v("## uploadKeys() : success, $uploadedKeys key(s) sent") Timber.v("## uploadKeys() : success, $uploadedKeys key(s) sent")
} }
@ -106,8 +106,8 @@ internal class OneTimeKeysUploader @Inject constructor(
oneTimeKeyCheckInProgress = false oneTimeKeyCheckInProgress = false
} }
private suspend fun fetchOtkNumber(): Int? { private suspend fun fetchOtkCount(): Int? {
return tryOrNull { return tryOrNull("Unable to get OTK count") {
val result = uploadKeysTask.execute(UploadKeysTask.Params(null, null)) val result = uploadKeysTask.execute(UploadKeysTask.Params(null, null))
result.oneTimeKeyCountsForAlgorithm(MXKey.KEY_SIGNED_CURVE_25519_TYPE) result.oneTimeKeyCountsForAlgorithm(MXKey.KEY_SIGNED_CURVE_25519_TYPE)
} }