Skip to content
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

fix_: ensure individual store queries do not exceed 24h while still allowing to retrieve more than one day of messages #6115

Merged
merged 1 commit into from
Nov 28, 2024

Conversation

richard-ramos
Copy link
Member

Fixes #6057

Also, due to how we use seconds in some parts of the code, there's a loss of precision in the end date of the store queries which translates in potentially missed messages. To quickly fix this I just add a second and subtract a nanosecond to ensure that the end date will include the whole second.

This however should be properly fixed by using time.Time across all codebase instead as mentioned in #5857 (comment)

cc: @fryorcraken

@status-im-auto
Copy link
Member

status-im-auto commented Nov 20, 2024

Jenkins Builds

Click to see older builds (32)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ a708ce1 #1 2024-11-20 19:17:02 ~4 min macos 📦zip
✔️ a708ce1 #1 2024-11-20 19:17:21 ~4 min windows 📦zip
✔️ a708ce1 #1 2024-11-20 19:17:52 ~5 min android 📦aar
✔️ a708ce1 #1 2024-11-20 19:18:03 ~5 min tests-rpc 📄log
✔️ a708ce1 #1 2024-11-20 19:18:46 ~6 min linux 📦zip
✔️ a708ce1 #1 2024-11-20 19:19:10 ~6 min ios 📦zip
✔️ a708ce1 #1 2024-11-20 19:20:12 ~7 min macos 📦zip
✔️ a708ce1 #1 2024-11-20 19:47:24 ~34 min tests 📄log
✔️ 38dce59 #2 2024-11-21 13:40:50 ~3 min windows 📦zip
✔️ 38dce59 #2 2024-11-21 13:41:54 ~4 min linux 📦zip
✔️ 38dce59 #2 2024-11-21 13:41:58 ~4 min ios 📦zip
✔️ 38dce59 #2 2024-11-21 13:41:58 ~4 min macos 📦zip
✔️ 38dce59 #2 2024-11-21 13:42:03 ~4 min tests-rpc 📄log
✔️ 38dce59 #2 2024-11-21 13:44:04 ~6 min android 📦aar
✔️ 38dce59 #2 2024-11-21 13:44:28 ~7 min macos 📦zip
✔️ 38dce59 #2 2024-11-21 14:10:32 ~33 min tests 📄log
✔️ 2244bfc #3 2024-11-25 16:07:31 ~3 min windows 📦zip
✔️ 2244bfc #3 2024-11-25 16:09:31 ~5 min macos 📦zip
✔️ 2244bfc #3 2024-11-25 16:09:48 ~5 min tests-rpc 📄log
✔️ 2244bfc #3 2024-11-25 16:09:49 ~5 min linux 📦zip
✔️ 2244bfc #3 2024-11-25 16:09:58 ~5 min macos 📦zip
✔️ 2244bfc #3 2024-11-25 16:10:05 ~6 min android 📦aar
✔️ 2244bfc #3 2024-11-25 16:10:22 ~6 min ios 📦zip
✔️ 2244bfc #3 2024-11-25 16:38:53 ~34 min tests 📄log
✔️ 757c9bb #4 2024-11-28 18:32:02 ~3 min windows 📦zip
✖️ 757c9bb #4 2024-11-28 18:32:51 ~4 min tests-rpc 📄log
✔️ 757c9bb #4 2024-11-28 18:33:36 ~5 min linux 📦zip
✔️ 757c9bb #4 2024-11-28 18:33:59 ~5 min macos 📦zip
✔️ 757c9bb #4 2024-11-28 18:34:47 ~6 min android 📦aar
✔️ 757c9bb #4 2024-11-28 18:35:11 ~6 min macos 📦zip
✔️ 757c9bb #4 2024-11-28 18:36:02 ~7 min ios 📦zip
✖️ 757c9bb #4 2024-11-28 18:41:31 ~12 min tests 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
50f2c74 #5 2024-11-28 18:42:08 ~31 sec windows 📄log
50f2c74 #5 2024-11-28 18:42:24 ~54 sec android 📄log
50f2c74 #5 2024-11-28 18:42:37 ~1 min linux 📄log
✖️ 50f2c74 #5 2024-11-28 18:42:37 ~1 min tests-rpc 📄log
✖️ 50f2c74 #5 2024-11-28 18:42:46 ~1 min tests 📄log
50f2c74 #5 2024-11-28 18:42:46 ~1 min ios 📄log
50f2c74 #5 2024-11-28 18:42:47 ~1 min macos 📄log
50f2c74 #5 2024-11-28 18:43:22 ~1 min macos 📄log
✔️ 6d2a89a #6 2024-11-28 18:47:35 ~3 min windows 📦zip
✔️ 6d2a89a #6 2024-11-28 18:49:16 ~4 min linux 📦zip
✔️ 6d2a89a #6 2024-11-28 18:49:34 ~5 min macos 📦zip
✔️ 6d2a89a #6 2024-11-28 18:49:50 ~5 min macos 📦zip
✔️ 6d2a89a #6 2024-11-28 18:49:57 ~5 min tests-rpc 📄log
✔️ 6d2a89a #6 2024-11-28 18:50:37 ~6 min ios 📦zip
✔️ 6d2a89a #6 2024-11-28 18:51:22 ~7 min android 📦aar
✖️ 6d2a89a #6 2024-11-28 19:15:39 ~31 min tests 📄log
✔️ 6d2a89a #7 2024-11-28 20:10:42 ~29 min tests 📄log

@@ -880,6 +855,8 @@ loop:
contentTopics: w.contentTopics,
cursor: cursor,
limit: nextPageLimit,
from: w.from,
to: nextWorkTo,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if above line cursor == nil?
It seems we need to first processNextPage with the cursor then process the nextWorkTo? Now it combines the cursor (processNextPage) and nextWorkTo.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah good point!

Copy link

codecov bot commented Nov 21, 2024

Codecov Report

Attention: Patch coverage is 53.84615% with 12 lines in your changes missing coverage. Please review.

Project coverage is 60.97%. Comparing base (84e05cf) to head (6d2a89a).
Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
protocol/messenger_mailserver_cycle.go 50.00% 6 Missing ⚠️
protocol/messenger_mailserver.go 50.00% 2 Missing and 1 partial ⚠️
services/mailservers/database.go 40.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #6115      +/-   ##
===========================================
+ Coverage    60.95%   60.97%   +0.01%     
===========================================
  Files          827      827              
  Lines       109734   109708      -26     
===========================================
+ Hits         66890    66895       +5     
+ Misses       34989    34964      -25     
+ Partials      7855     7849       -6     
Flag Coverage Δ
functional 14.18% <42.30%> (+0.08%) ⬆️
unit 59.98% <53.84%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
wakuv2/waku.go 68.77% <100.00%> (ø)
protocol/messenger_mailserver.go 44.96% <50.00%> (-0.95%) ⬇️
services/mailservers/database.go 76.17% <40.00%> (ø)
protocol/messenger_mailserver_cycle.go 61.01% <50.00%> (ø)

... and 24 files with indirect coverage changes

Copy link
Member

@jrainville jrainville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

BTW, we found today with @Ivansete-status that some of the store requests fetched a whole month. I assume it was an account recovery, but not sure.

So I guess this PR would fix it.

One additional improvement in that case would be to make the account recovery smarter. If you fetched all the needed info in the last 24 hours, you don't need the info from a week past, since you only need the most recent.

Maybe something to fix in another issue. Though I'm not sure if it should be fixed by the Status or Waku team 🤔

@richard-ramos
Copy link
Member Author

richard-ramos commented Nov 21, 2024

@jrainville: One additional improvement in that case would be to make the account recovery smarter. If you fetched all the needed info in the last 24 hours, you don't need the info from a week past, since you only need the most recent.

To fix that, we can do something similar to what @igor-sirotin implemented here:

return nil, r.manager.messenger.processMailserverBatchWithOptions(ms, batch, r.config.InitialPageSize, r.shouldFetchNextPage, true)
In which a function is passed to processMailserverBatchWithOptions to indicate whether to continue fetching messages from storenode or not.

@kaichaosun
Copy link
Contributor

This PR also fix #6046

@jrainville jrainville merged commit 35e4c9e into develop Nov 28, 2024
18 checks passed
@jrainville jrainville deleted the 24h-batches branch November 28, 2024 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

waku: ensure that fetching a community is done using 24h query batches
5 participants