1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00
Files
wrestlingdev.com/app/jobs/generate_tournament_matches_job.rb

22 lines
768 B
Ruby

class GenerateTournamentMatchesJob < ApplicationJob
queue_as :default
limits_concurrency to: 1, key: ->(tournament) { "tournament:#{tournament.id}" }
def perform(tournament)
# Log information about the job
Rails.logger.info("Starting tournament match generation for tournament ##{tournament.id}")
begin
# Execute the job
generator = GenerateTournamentMatches.new(tournament)
generator.generate_raw
Rails.logger.info("Completed tournament match generation for tournament ##{tournament.id}")
rescue => e
Rails.logger.error("Error generating tournament matches: #{e.message}")
Rails.logger.error(e.backtrace.join("\n"))
raise # Re-raise the error so it's properly recorded
end
end
end