Add occasional random fetches to article page_views_count (#1625)

This commit is contained in:
Ben Halpern 2019-01-22 14:39:34 -05:00 committed by GitHub
parent 300291ed70
commit ff405c0e90
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,7 +36,7 @@ class ArticleAnalyticsFetcher
def should_fetch(article)
return true if @context == "force"
article.positive_reactions_count > article.previous_positive_reactions_count
# Mostly fetch if positive reactions count has gone up, but occasionally re-fetch anyway.
article.positive_reactions_count > article.previous_positive_reactions_count || rand(25) == 1
end
end