Small efficiency adjustments (#20782)

This commit is contained in:
Ben Halpern 2024-03-21 10:42:37 -04:00 committed by GitHub
parent 01b55c646b
commit c3c8b5f9c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -18,7 +18,7 @@ class BillboardEventsController < ApplicationMetalController
def update_billboards_data
billboard_event_id = billboard_event_params[:billboard_id]
ThrottledCall.perform("billboards_data_update-#{billboard_event_id}", throttle_for: 15.minutes) do
ThrottledCall.perform("billboards_data_update-#{billboard_event_id}", throttle_for: 25.minutes) do
@billboard = Billboard.find(billboard_event_id)
num_impressions = @billboard.billboard_events.impressions.sum(:counts_for)

View file

@ -38,6 +38,7 @@ module Articles
def other_suggestions(max: MAX_DEFAULT, ids_to_ignore: [])
ids_to_ignore << article.id
Article.published
.where("published_at > ?", 3.months.ago)
.where.not(id: ids_to_ignore)
.not_authored_by(article.user_id)
.order(hotness_score: :desc)
@ -48,6 +49,7 @@ module Articles
def suggestions_by_tag(max: MAX_DEFAULT)
Article
.published
.where("published_at > ?", 3.months.ago)
.cached_tagged_with_any(cached_tag_list_array)
.not_authored_by(article.user_id)
.where(tag_suggestion_query)