-
Notifications
You must be signed in to change notification settings - Fork 731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/fga/simplify timeline logic #6318
Conversation
val chunkEntity = if (!isLimited && lastChunk != null) { | ||
lastChunk | ||
} else { | ||
// Delete all chunks of the room in case of gap. | ||
ChunkEntity.findAll(realm, roomId).forEach { | ||
it.deleteOnCascade(false, canDeleteRoot = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
canDeleteRoot = true
is there a risk to delete state event here? Or Event needed for aggregation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will delete everything except state events
...roid/src/main/java/org/matrix/android/sdk/internal/database/migration/MigrateSessionTo030.kt
Outdated
Show resolved
Hide resolved
…al/database/migration/MigrateSessionTo030.kt Co-authored-by: Benoit Marty <[email protected]>
chunk.getList(ChunkEntityFields.TIMELINE_EVENTS.`$`).clearWith { timelineEvent -> | ||
// Don't delete state events | ||
if (timelineEvent.isNull(TimelineEventEntityFields.ROOT.STATE_KEY)) { | ||
timelineEvent.getObject(TimelineEventEntityFields.ROOT.`$`)?.deleteFromRealm() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see there may be also other entities attached to the event such as: EventAnnotationsSummaryEntity
and ReadReceiptsSummaryEntity
. Is it okay to keep them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we can keep them, they are kind of independent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -445,7 +445,7 @@ internal class TimelineChunk( | |||
Timber.e(failure, "Failed to fetch from server") | |||
LoadMoreResult.FAILURE | |||
} | |||
return if (loadMoreResult == LoadMoreResult.SUCCESS) { | |||
return if (loadMoreResult != LoadMoreResult.FAILURE) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checking, is it intended to call loadMore
when result is LoadMoreResult.REACHED_END
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the downside of linking the last permalink chunk to the lastForward chunk... I still don't know if we want this or just add timeline events from sync on both chunks instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good for me. I have just added one question about something I was not sure.
SonarCloud Quality Gate failed. |
* Sync: delete all previous chunks in case of gappy sync * Chunk: dont link chunks if we find existing timeline event (keep multiple timeline events in db) * Timeline : remove some unused code * Clean and add changelog * Timeline: set named argument * Timeline: avoid restarting the timeline when there is a CancellationException due to permalink * Timeline: add migration to clean up old (broken) chunks * Update matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/database/migration/MigrateSessionTo030.kt Co-authored-by: Benoit Marty <[email protected]> * Timeline: try to fix test * ignoring broken instrumentation test in order to release Co-authored-by: ganfra <[email protected]> Co-authored-by: Benoit Marty <[email protected]> Co-authored-by: Adam Brown <[email protected]>
@@ -0,0 +1 @@ | |||
Fix loop in timeline and simplify management of chunks and timeline events. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this also close the following? They seem like duplicates of #5166 anway
Type of change
Content
Simplify the management of timeline events and chunks :
Motivation and context
There was multiple scenarios where we had missing messages or loops in timeline.
This fixes #6312 and fixes #5166
Tested devices
Checklist