resist ConnectivityManager$TooManyRequestsException
This commit is contained in:
parent
90a4e71b06
commit
6fd99dc302
@ -56,19 +56,17 @@ class SpaceCreationTest : InstrumentedTest {
|
|||||||
val roomName = "My Space"
|
val roomName = "My Space"
|
||||||
val topic = "A public space for test"
|
val topic = "A public space for test"
|
||||||
var spaceId: String = ""
|
var spaceId: String = ""
|
||||||
commonTestHelper.waitWithLatch {
|
commonTestHelper.runBlockingTest {
|
||||||
spaceId = session.spaceService().createSpace(roomName, topic, null, true)
|
spaceId = session.spaceService().createSpace(roomName, topic, null, true)
|
||||||
// wait a bit to let the summary update it self :/
|
|
||||||
it.countDown()
|
|
||||||
}
|
}
|
||||||
Thread.sleep(4_000)
|
|
||||||
|
|
||||||
val syncedSpace = session.spaceService().getSpace(spaceId)
|
|
||||||
commonTestHelper.waitWithLatch {
|
commonTestHelper.waitWithLatch {
|
||||||
commonTestHelper.retryPeriodicallyWithLatch(it) {
|
commonTestHelper.retryPeriodicallyWithLatch(it) {
|
||||||
syncedSpace?.asRoom()?.roomSummary()?.name != null
|
session.spaceService().getSpace(spaceId)?.asRoom()?.roomSummary()?.name != null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val syncedSpace = session.spaceService().getSpace(spaceId)
|
||||||
assertEquals("Room name should be set", roomName, syncedSpace?.asRoom()?.roomSummary()?.name)
|
assertEquals("Room name should be set", roomName, syncedSpace?.asRoom()?.roomSummary()?.name)
|
||||||
assertEquals("Room topic should be set", topic, syncedSpace?.asRoom()?.roomSummary()?.topic)
|
assertEquals("Room topic should be set", topic, syncedSpace?.asRoom()?.roomSummary()?.topic)
|
||||||
// assertEquals(topic, syncedSpace.asRoom().roomSummary()?., "Room topic should be set")
|
// assertEquals(topic, syncedSpace.asRoom().roomSummary()?., "Room topic should be set")
|
||||||
|
@ -70,7 +70,15 @@ internal class PreferredNetworkCallbackStrategy @Inject constructor(context: Con
|
|||||||
|
|
||||||
override fun register(hasChanged: () -> Unit) {
|
override fun register(hasChanged: () -> Unit) {
|
||||||
hasChangedCallback = hasChanged
|
hasChangedCallback = hasChanged
|
||||||
conn.registerDefaultNetworkCallback(networkCallback)
|
// Add a try catch for safety
|
||||||
|
// TODO: It happens when running all tests in CI, at some points we reach a limit here causing TooManyRequestsException
|
||||||
|
// and crashing the sync thread. We might have problem here, would need some investigation
|
||||||
|
// for now adding a catch to allow CI to continue running
|
||||||
|
try {
|
||||||
|
conn.registerDefaultNetworkCallback(networkCallback)
|
||||||
|
} catch (t: Throwable) {
|
||||||
|
Timber.e(t, "Unable to register default network callback")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun unregister() {
|
override fun unregister() {
|
||||||
|
Loading…
Reference in New Issue
Block a user