Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
[IMPROVEMENT] DataController fetching partial database messages and code improvements #2253
Conversation
| @@ -291,7 +301,7 @@ final class MessagesViewModel { | |||
| guard let subscription = subscription?.validated() else { return } | |||
| guard let subscriptionDetached = subscription.unmanaged else { return } | |||
|
|
|||
| let messages = subscription.fetchMessages(50, lastMessageDate: oldestMessage) | |||
| let messages = subscription.fetchMessages(30, lastMessageDate: oldestMessage) | |||
filipealva
Oct 15, 2018
Collaborator
The PR is looking really good! I can feel the improvement when opening chats, but it seems to have a little inconsistency.
On the description you said that it is fetching a page of 40 messages, and here on the code I see 30, but the real issue is that when debbuging each time fetchMessages gets called I see 60 sections/messages being inserted on our list, so it seems to be doubling up this page size right here.
The PR is looking really good! I can feel the improvement when opening chats, but it seems to have a little inconsistency.
On the description you said that it is fetching a page of 40 messages, and here on the code I see 30, but the real issue is that when debbuging each time fetchMessages gets called I see 60 sections/messages being inserted on our list, so it seems to be doubling up this page size right here.
rafaelks
Oct 15, 2018
Author
Contributor
@filipealva Just fixed the description of the PR to this number... where do you see 60? Can you point to the breakpoint you're using?
@filipealva Just fixed the description of the PR to this number... where do you see 60? Can you point to the breakpoint you're using?
filipealva
Oct 15, 2018
Collaborator
@rafaelks Initially I added the breakpoint inside RocketChatViewController's UIKit extension, inside the batch updates on line 45, then I print the changeset.sectionInserted property and it gives me 60 items, i.e. after doing the diffing there are 60 insertions.
Now I went back on it and tried to spot the same before the diffing, and I could manage to see the method func handle(insertions: [Int], on messagesQuery: Results<Message>) handling 60 items regularly.
It doesn't happens always, sometimes there are 20 insertions and another aleatory numbers, but if you keep testing you'll see that the most common number of insertions we have is 60 which is the double of the size we should be handling.
See the screenshot below:
@rafaelks Initially I added the breakpoint inside RocketChatViewController's UIKit extension, inside the batch updates on line 45, then I print the changeset.sectionInserted property and it gives me 60 items, i.e. after doing the diffing there are 60 insertions.
Now I went back on it and tried to spot the same before the diffing, and I could manage to see the method func handle(insertions: [Int], on messagesQuery: Results<Message>) handling 60 items regularly.
It doesn't happens always, sometimes there are 20 insertions and another aleatory numbers, but if you keep testing you'll see that the most common number of insertions we have is 60 which is the double of the size we should be handling.
See the screenshot below:
rafaelks
Oct 15, 2018
Author
Contributor
@filipealva I see... you're seeing the observer from Realm, so new results in database would result in all these new values, because the request we're doing it for 60 new messages. Good finding, I'll change the parameter to 30 for now. 👍
@filipealva I see... you're seeing the observer from Realm, so new results in database would result in all these new values, because the request we're doing it for 60 new messages. Good finding, I'll change the parameter to 30 for now.
Codecov Report
@@ Coverage Diff @@
## feature/integrate-rc-view-controller #2253 +/- ##
========================================================================
- Coverage 26.53% 26.53% -0.01%
========================================================================
Files 423 423
Lines 15877 15878 +1
========================================================================
Hits 4213 4213
- Misses 11664 11665 +1
Continue to review full report at Codecov.
|
|
It's working beautifully! Really nice improvements |
abda423
into
feature/integrate-rc-view-controller

@RocketChat/ios
This pull-request resolves couple of issues: