Skip to content

Commit

Permalink
Remove TrackJob
Browse files Browse the repository at this point in the history
Highest volume async job by several orders of magnitude and yet we've
never once used the data it produces.
  • Loading branch information
glacials committed Oct 20, 2024
1 parent 19ff83c commit 257ef51
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 41 deletions.
8 changes: 0 additions & 8 deletions app/controllers/api/v3/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ class Api::V3::ApplicationController < ActionController::Base
include Rails::Pagination

before_action :read_only_mode, if: -> { ENV["READ_ONLY_MODE"] == "1" }
before_action :track

def options
headers["Allow"] = "POST, PUT, DELETE, GET, OPTIONS"
Expand All @@ -15,11 +14,4 @@ def read_only_mode
render template: "pages/read_only_mode"
end
end

def track
TrackJob.perform_later(
category: controller_name,
action: action_name,
)
end
end
8 changes: 0 additions & 8 deletions app/controllers/api/v4/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ class Api::V4::ApplicationController < ActionController::Base
include Rails::Pagination

before_action :read_only_mode, if: -> { ENV["READ_ONLY_MODE"] == "1" }
before_action :track

rescue_from ActionController::ParameterMissing do |e|
render status: :bad_request, json: { status: 400, message: e.message }
Expand Down Expand Up @@ -121,11 +120,4 @@ def set_race(param: :race_id) # rubocop:disable Naming/AccessorMethodName
rescue ActiveRecord::RecordNotFound
render not_found(:race)
end

def track
TrackJob.perform_later(
category: controller_name,
action: action_name,
)
end
end
2 changes: 0 additions & 2 deletions app/controllers/api/v4/speedrunslive_races_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
class Api::V4::SpeedrunsliveRacesController < Api::V4::ApplicationController
skip_before_action :track

def index
Rails.cache.fetch('srl_races', expires_in: 1.minute) do
render json: SpeedRunsLive::Race.all
Expand Down
2 changes: 0 additions & 2 deletions app/controllers/api/v4/time_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
class Api::V4::TimeController < Api::V4::ApplicationController
skip_before_action :track

def create
render status: :ok, json: {
status: 200,
Expand Down
9 changes: 0 additions & 9 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class ApplicationController < ActionController::Base
before_action :sanitize_pagination_params
before_action :read_only_mode, if: -> { ENV["READ_ONLY_MODE"] == "1" }
before_action :authorize_rmp
before_action :track

rescue_from Authie::Session::ValidityError, with: :auth_session_error
rescue_from Authie::Session::InactiveSession, with: :auth_session_error
Expand Down Expand Up @@ -75,12 +74,4 @@ def auth_session_error
def authorize_rmp
Rack::MiniProfiler.authorize_request if current_user.try(:admin?)
end

def track
return if controller_name == "health"
TrackJob.perform_later(
category: controller_name,
action: action_name,
)
end
end
12 changes: 0 additions & 12 deletions app/jobs/track_job.rb

This file was deleted.

0 comments on commit 257ef51

Please sign in to comment.