Skip to content

Commit

Permalink
MXRoomSummary: Fix infinite loop when using MXNoStore
Browse files Browse the repository at this point in the history
This issue slowed down integration tests a lot.
  • Loading branch information
manuroe committed Apr 14, 2020
1 parent 04c2611 commit b4d5ba7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions MatrixSDK/Data/MXRoomSummary.m
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,15 @@ - (MXHTTPOperation *)fetchLastMessage:(void (^)(void))complete failure:(void (^)
newOperation = [liveTimeline paginate:messagesToPaginate direction:MXTimelineDirectionBackwards onlyFromStore:NO complete:^{

// Received messages have been stored in the store. We can make a new loop
[self fetchLastMessage:complete failure:failure
lastEventIdChecked:lastEventIdCheckedInBlock
operation:(operation ? operation : newOperation)
commit:commit];
// XXX: This is only true for a permanent storage. Only MXNoStore is not permanent.
// MXNoStore is only used for tests. We can skip it here.
if (self.mxSession.store.isPermanent)
{
[self fetchLastMessage:complete failure:failure
lastEventIdChecked:lastEventIdCheckedInBlock
operation:(operation ? operation : newOperation)
commit:commit];
}

} failure:failure];

Expand Down

0 comments on commit b4d5ba7

Please sign in to comment.