Skip to content

Commit

Permalink
Added debug logging to ping thread.
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock committed Aug 29, 2018
1 parent d1aa8a4 commit 16d6509
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions lib/slack-ruby-bot-server/ping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,24 @@ def initialize(client, options = {})

def start!
::Async::Reactor.run do |task|
loop do
task.sleep ping_interval
break unless check!
end
run(task)
end
end

private

def run(task)
loop do
logger.debug "PING: #{owner}, every #{ping_interval} second(s)"
task.sleep ping_interval
break unless check!
end
logger.warn "Done pinging team #{owner.id}."
rescue StandardError => e
logger.error e
raise e
end

def check!
if online?
@error_count = 0
Expand Down Expand Up @@ -60,7 +69,7 @@ def down!
end

def restart!
logger.warn "RESTART: #{owner}"
logger.warn "RESTART: #{owner}, #{driver}"
driver.close if driver
end

Expand Down

0 comments on commit 16d6509

Please sign in to comment.