Class: Tarbit::StatisticWatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/tarbit/statistic_watcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(server, interval) ⇒ StatisticWatcher

Returns a new instance of StatisticWatcher.



8
9
10
11
12
13
# File 'lib/tarbit/statistic_watcher.rb', line 8

def initialize(server, interval)
  @server = server
  @interval = interval.nil? ? 600 : interval.to_i
  @history = []
  Async.logger.info "SatisticWatcher - Starting watcher with interval #{@interval}"
end

Instance Method Details

#watchObject



15
16
17
18
19
20
21
22
# File 'lib/tarbit/statistic_watcher.rb', line 15

def watch
  Async do |task|
    while true
      task.sleep @interval
      create_point_in_time
    end
  end
end