Skip to content

Change trending hashtags to not disappear instantly after midnight#11712

Merged
Gargron merged 1 commit intomasterfrom
feature-trending-tags-decay
Sep 2, 2019
Merged

Change trending hashtags to not disappear instantly after midnight#11712
Gargron merged 1 commit intomasterfrom
feature-trending-tags-decay

Conversation

@Gargron
Copy link
Copy Markdown
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
@Gargron Gargron force-pushed the feature-trending-tags-decay branch from 6dcf63a to 229e451 Compare September 1, 2019 07:03
Copy link
Copy Markdown
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).

Comment thread app/models/trending_tags.rb
end
end

users_for_review = User.staff.includes(:account).to_a.select(&:allows_trending_tag_emails?)
Copy link
Copy Markdown
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.

Comment thread config/sidekiq.yml
@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.

2 participants