Skip to content

Commit

Permalink
null case handled
Browse files Browse the repository at this point in the history
  • Loading branch information
saddaqayyum57 committed Jun 20, 2016
1 parent 0116b73 commit ad153f4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ def update_bitcoin_balance

if BitcoinAddress.where('updated_at > ?',10.seconds.ago).empty? # don't DOS blockchain.info
bitcoin_address = BitcoinAddress.unscoped.order("updated_at ASC").first
if bitcoin_address.updated_at < 10.minutes.ago # no need to do it too often
bitcoin_address.update_balance
if bitcoin_address
if bitcoin_address.updated_at < 10.minutes.ago # no need to do it too often
bitcoin_address.update_balance
end
end
end

Expand Down

0 comments on commit ad153f4

Please sign in to comment.