-
Notifications
You must be signed in to change notification settings - Fork 1
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
chore: refactor hot tags endpoint #294
base: main
Are you sure you want to change the base?
Conversation
WITH DISTINCT reach, MAX(tag.indexed_at) AS latest_tag_time | ||
ORDER BY latest_tag_time DESC | ||
|
||
// Use slice notation instead of SKIP and LIMIT |
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.
is there a reason for this?
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, if we use SKIP
and LIMIT
together, the SKIP
clause does not work as it has to. That's why I went with slice notation, it is not the optimal but it works
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.
yeah the original question meant to ask why wouldn't skip and limit work?
tests/service/tags/hot.rs
Outdated
@@ -598,16 +672,18 @@ async fn test_hot_tags_by_friends_reach_and_all_timeframe() -> Result<()> { | |||
|
|||
const PUBKY_TAG: &str = "pubky"; | |||
|
|||
// KEEP ON EYE in the list. Sometimes it changes the order. No reason |
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 isn't really good. If the order changes we have two options:
- Fix the database queries to make sure the order is set so it's not random.
- In the test, evaluate the list in a way that the order won't matter.
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.
and this is what it is done, test_hot_tags_label_taggers
make two request because the list was changing the order
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.
how's that going to solve it? Also why does it do 2 requests? First one seems to not pass params but the second one is passing a skip, limit?
I don't understand why.
Pre-submission Checklist
cargo test
.cargo bench