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

Change trending hashtags to not disappear instantly after midnight #11712

Merged
merged 1 commit into from
Sep 2, 2019

Conversation

Gargron
Copy link
Member

@Gargron Gargron commented Sep 1, 2019

When a hashtag is used, update its counters, and mark it down as used on that day for easy retrieval. Do not calculate the score right then, instead, add a regular scheduler. The scheduler goes over all used hashtags, and hashtags that were previously in the trends, and recalculates their scores. If a score peaks, record the time at which it peaked. Use the peak score, but decay it from the point at which it peaked with a half-life of 6 hours, for the sorting in the trends.

This removes the need to fully reset the trends at midnight, while ensuring that newer trends take precedence over older ones.

@Gargron Gargron force-pushed the feature-trending-tags-decay branch 5 times, most recently from 718fa24 to 6dcf63a Compare September 1, 2019 06:41
@Gargron Gargron marked this pull request as ready for review September 1, 2019 06:42
Copy link
Contributor

@ClearlyClaire ClearlyClaire left a comment

Choose a reason for hiding this comment

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

Seems good overall, but I have a few reservations (see inline comments).

app/models/trending_tags.rb Show resolved Hide resolved
end
end

users_for_review = User.staff.includes(:account).to_a.select(&:allows_trending_tag_emails?)
Copy link
Contributor

Choose a reason for hiding this comment

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

The name is slightly misleading, I was confused this was about reviewing users, and not users that should receive a notification about trending hashtags.

config/sidekiq.yml Show resolved Hide resolved
@Gargron Gargron merged commit 70ddef2 into master Sep 2, 2019
@Gargron Gargron deleted the feature-trending-tags-decay branch September 2, 2019 16:11
hiyuki2578 pushed a commit to ProjectMyosotis/mastodon that referenced this pull request Oct 2, 2019
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.

None yet

2 participants