update character page
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class WowItemsWorker < WowSidekiqWorker
|
||||
def perform(item_id, batch_size)
|
||||
def perform(item_id, batch_size, keep_going_on)
|
||||
RBattlenet.authenticate(client_id: ENV['BLIZZARD_API_CLIENT_ID'], client_secret: ENV['BLIZZARD_API_CLIENT_SECRET'])
|
||||
RBattlenet.set_options(locale: 'all')
|
||||
|
||||
@@ -43,8 +43,10 @@ class WowItemsWorker < WowSidekiqWorker
|
||||
wow_item.save
|
||||
end
|
||||
|
||||
# Create a new job for the next batch
|
||||
WowItemsWorker.perform_async(result.results.last.data.id + 1, batch_size) unless result.results.count.zero?
|
||||
# Create a new job for the next batch if keep_going_on is true
|
||||
return unless keep_going_on && !result.results.count.zero?
|
||||
|
||||
WowItemsWorker.perform_async(result.results.last.data.id + 1, batch_size, keep_going_on)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user