Skip to content

Commit 96798ac

Browse files
authored
Merge pull request #4076 from element-hq/feature/fga/dispatch_timeline_creations
fix(timeline) : dispatch timeline creations trying to avoid ANRs
2 parents b1b6f9e + f2bc736 commit 96798ac

File tree

1 file changed

+6
-6
lines changed
  • libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room

1 file changed

+6
-6
lines changed

libraries/matrix/impl/src/main/kotlin/io/element/android/libraries/matrix/impl/room/RustMatrixRoom.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ class RustMatrixRoom(
204204

205205
override suspend fun subscribeToSync() = roomSyncSubscriber.subscribe(roomId)
206206

207-
override suspend fun timelineFocusedOnEvent(eventId: EventId): Result<Timeline> {
208-
return runCatching {
207+
override suspend fun timelineFocusedOnEvent(eventId: EventId): Result<Timeline> = withContext(roomDispatcher) {
208+
runCatching {
209209
innerRoom.timelineFocusedOnEvent(
210210
eventId = eventId.value,
211211
numContextEvents = 50u,
@@ -222,8 +222,8 @@ class RustMatrixRoom(
222222
}
223223
}
224224

225-
override suspend fun pinnedEventsTimeline(): Result<Timeline> {
226-
return runCatching {
225+
override suspend fun pinnedEventsTimeline(): Result<Timeline> = withContext(roomDispatcher) {
226+
runCatching {
227227
innerRoom.pinnedEventsTimeline(
228228
internalIdPrefix = "pinned_events",
229229
maxEventsToLoad = 100u,
@@ -238,8 +238,8 @@ class RustMatrixRoom(
238238
}
239239
}
240240

241-
override suspend fun mediaTimeline(): Result<Timeline> {
242-
return runCatching {
241+
override suspend fun mediaTimeline(): Result<Timeline> = withContext(roomDispatcher) {
242+
runCatching {
243243
innerRoom.messageFilteredTimeline(
244244
internalIdPrefix = "MediaGallery_",
245245
allowedMessageTypes = listOf(

0 commit comments

Comments
 (0)