class ZooniverseSocial::TaskObserver

Public Class Methods

new(task, restart) click to toggle source
# File lib/zooniverse_social/task_observer.rb, line 3
def initialize(task, restart)
  @task = task
  @restart = restart
  @task.add_observer self
end

Public Instance Methods

update(time, result, error) click to toggle source
# File lib/zooniverse_social/task_observer.rb, line 9
def update(time, result, error)
  if error.is_a?(Concurrent::TimeoutError)
    @task.shutdown
    @restart.call
  end
end