Skip to content
Permalink
Browse files

Attempt at restarting dead teams.

  • Loading branch information...
dblock committed Jun 13, 2018
1 parent 8b9ccd9 commit bc293248bae678dd9299b1d2888443adedae4da8
Showing with 20 additions and 0 deletions.
  1. +20 −0 slack-strava/app.rb
@@ -10,6 +10,7 @@ def after_start!
end
once_and_every 60 * 60 do
expire_subscriptions!
ping_teams!
end
once_and_every 10 * 60 do
brag!
@@ -31,6 +32,25 @@ def once_and_every(tt)
end
end

def ping_teams!
Team.active.each do |team|
begin
ping = team.ping!
next if ping[:presence].online
logger.warn "DOWN: #{team}"
after 60 do
ping = team.ping!
unless ping[:presence].online
logger.info "RESTART: #{team}"
SlackStrava::Service.instance.start!(team)
end
end
rescue StandardError => e
logger.warn "Error pinging team #{team}, #{e.message}."
end
end
end

def check_trials!
log_info_without_repeat "Checking trials for #{Team.active.trials.count} team(s)."
Team.active.trials.each do |team|

0 comments on commit bc29324

Please sign in to comment.
You can’t perform that action at this time.