Module: CloudWatchMetrics::Base

Included in:
Resque
Defined in:
lib/cloud_watch_metrics/base.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



5
6
7
# File 'lib/cloud_watch_metrics/base.rb', line 5

def self.included(mod)
  mod.extend(ClassMethods)
end

Instance Method Details

#runObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/cloud_watch_metrics/base.rb', line 15

def run
  if @interval
    loop do
      start = Time.now
      Timeout.timeout(@interval * 2 - 1) { run_once }
      sleep((start - Time.now) % @interval)
    end
  else
    run_once
  end
end