mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-25 11:05:25 +00:00
Polling improvement for group
This commit is contained in:
parent
4536aca327
commit
0657ab2305
@ -27,6 +27,7 @@ import org.session.libsession.utilities.ConfigFactoryProtocol
|
|||||||
import org.session.libsession.utilities.ConfigMessage
|
import org.session.libsession.utilities.ConfigMessage
|
||||||
import org.session.libsession.utilities.getClosedGroup
|
import org.session.libsession.utilities.getClosedGroup
|
||||||
import org.session.libsignal.database.LokiAPIDatabaseProtocol
|
import org.session.libsignal.database.LokiAPIDatabaseProtocol
|
||||||
|
import org.session.libsignal.exceptions.NonRetryableException
|
||||||
import org.session.libsignal.utilities.AccountId
|
import org.session.libsignal.utilities.AccountId
|
||||||
import org.session.libsignal.utilities.Log
|
import org.session.libsignal.utilities.Log
|
||||||
import org.session.libsignal.utilities.Namespace
|
import org.session.libsignal.utilities.Namespace
|
||||||
@ -88,7 +89,7 @@ class ClosedGroupPoller(
|
|||||||
|
|
||||||
result.isFailure -> {
|
result.isFailure -> {
|
||||||
val error = result.exceptionOrNull()!!
|
val error = result.exceptionOrNull()!!
|
||||||
if (error is CancellationException) {
|
if (error is CancellationException || error is NonRetryableException) {
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +102,9 @@ class ClosedGroupPoller(
|
|||||||
}
|
}
|
||||||
} catch (e: CancellationException) {
|
} catch (e: CancellationException) {
|
||||||
throw e
|
throw e
|
||||||
|
} catch (e: NonRetryableException) {
|
||||||
|
Log.e(TAG, "Non-retryable error during group poller", e)
|
||||||
|
throw e
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e(TAG, "Error during group poller", e)
|
Log.e(TAG, "Error during group poller", e)
|
||||||
delay(POLL_ERROR_RETRY_DELAY)
|
delay(POLL_ERROR_RETRY_DELAY)
|
||||||
@ -131,9 +135,16 @@ class ClosedGroupPoller(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val adminKey = requireNotNull(configFactoryProtocol.getClosedGroup(closedGroupSessionId)) {
|
val group = configFactoryProtocol.getClosedGroup(closedGroupSessionId)
|
||||||
"Group doesn't exist"
|
if (group == null) {
|
||||||
}.adminKey
|
throw NonRetryableException("Group doesn't exist")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (group.kicked) {
|
||||||
|
throw NonRetryableException("Group has been kicked")
|
||||||
|
}
|
||||||
|
|
||||||
|
val adminKey = group.adminKey
|
||||||
|
|
||||||
val pollingTasks = mutableListOf<Pair<String, Deferred<*>>>()
|
val pollingTasks = mutableListOf<Pair<String, Deferred<*>>>()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user