mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-05-20 20:17:45 +00:00
Refactored match winner and wrestlers matches and fixed slow tests.
This commit is contained in:
@@ -1,18 +1,11 @@
|
||||
class AdvanceWrestlerJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
# Class method for direct execution in test environment
|
||||
def self.perform_sync(wrestler, match)
|
||||
# Execute directly on provided objects
|
||||
service = AdvanceWrestler.new(wrestler, match)
|
||||
service.advance_raw
|
||||
end
|
||||
|
||||
def perform(wrestler, match)
|
||||
# Add a small delay to increase chance of transaction commit
|
||||
# without this some matches were getting a deserialization error when running the rake task
|
||||
# to finish tournaments
|
||||
sleep(0.5)
|
||||
sleep(0.5) unless Rails.env.test?
|
||||
|
||||
# Get tournament from wrestler
|
||||
tournament = wrestler.tournament
|
||||
|
||||
Reference in New Issue
Block a user