Commit 8dd35cac authored by nazarf's avatar nazarf

fix check_active_list

parent 86b3708a
...@@ -26,17 +26,22 @@ namespace :miners do ...@@ -26,17 +26,22 @@ namespace :miners do
message.send_with(bot) message.send_with(bot)
end end
task check_active_list: :environment do task check_active_list: :environment do
url = 'http://144.202.99.58:4243/active_list' url = 'http://144.202.99.58:4243/active_list'
response = HTTParty.get(url) response_json = []
begin
response = HTTParty.get(url)
response_json = JSON.parse(response.body) response_json = JSON.parse(response.body)
rescue => e
puts e
end
time = DateTime.now time = DateTime.now
miners = Miner.all miners = Miner.all
if response_json == [] if response_json == []
miners.update_all(status: Miner::STATUSES[0]) miners.update_all(status: Miner::STATUSES[0])
return
end end
miners.each do |miner| miners.each do |miner|
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment