Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/workers/calculate_address_info_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ def perform()
end
Rails.cache.write(key, local_tip_block.id)

Address.where(id: contained_address_ids).find_in_batches do |group|
sleep(50) # Make sure it doesn't get too crowded in there!
Address.where(id: contained_address_ids).find_in_batches(batch_size: 100).with_index do |group, batch|
puts "Processing group ##{batch}"
address_attributes = []

group.each do |addr|
# puts addr.id
balance, balance_occupied = addr.cal_balance
address_attributes << {
id: addr.id,
Expand Down
4 changes: 4 additions & 0 deletions lib/scheduler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ def call_worker(clz)
call_worker ContractStatisticWorker
end

s.every "10h" overlap: false do
call_worker CalculateAddressInfoWorker
end

s.cron "0,30 * * * *" do
BitcoinStatistic.refresh
end
Expand Down