Skip to content

Commit

Permalink
Adjust billboard event retabulation throttle (forem#21202)
Browse files Browse the repository at this point in the history
* Adjust throttle for billboard event retabulation

* Change to return
  • Loading branch information
benhalpern authored Aug 13, 2024
1 parent 2a898e9 commit 3398389
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/controllers/billboard_events_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
class BillboardEventsController < ApplicationMetalController
include ActionController::Head
SIGNUP_SUCCESS_MODIFIER = 25 # One signup is worth 25 clicks
THROTTLE_TIME = 25
# No policy needed. All views are for all users

def create
Expand All @@ -17,9 +18,11 @@ def create

def update_billboards_data
billboard_event_id = billboard_event_params[:billboard_id]
throttle_time = ApplicationConfig["BILLBOARD_EVENT_THROTTLE_TIME"] || THROTTLE_TIME

ThrottledCall.perform("billboards_data_update-#{billboard_event_id}", throttle_for: 25.minutes) do
ThrottledCall.perform("billboards_data_update-#{billboard_event_id}", throttle_for: throttle_time.minutes) do
@billboard = Billboard.find(billboard_event_id)
return if rand(2).zero? && @billboard.impressions_count > 100_000

num_impressions = @billboard.billboard_events.impressions.sum(:counts_for)
num_clicks = @billboard.billboard_events.clicks.sum(:counts_for)
Expand Down

0 comments on commit 3398389

Please sign in to comment.