Skip to content

Commit

Permalink
Fetch the play fresh instead of using the cached one
Browse files Browse the repository at this point in the history
  • Loading branch information
minter committed Dec 14, 2024
1 parent 19c7a29 commit b8aea34
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions app/workers/rod_the_bot/penalty_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class PenaltyWorker

def perform(game_id, play)
@feed = NhlApi.fetch_pbp_feed(game_id)
@play = play
return if play.blank?
@play = NhlApi.fetch_play(game_id, play["eventId"])
return if @play.nil?

# Check if descKey is still "minor" and re-queue if so
Expand All @@ -36,8 +37,6 @@ def perform(game_id, play)
@their_team = home
end

return if @feed["plays"].find { |play| play["eventId"] == @play["eventId"] }.blank?

players = build_players(@feed)

penalized_player = players[@play["details"]["committedByPlayerId"]] || players[@play["details"]["servedByPlayerId"]]
Expand Down

0 comments on commit b8aea34

Please sign in to comment.