Module: NimbleNodes::Dynos

Defined in:
lib/nimble_nodes/dynos.rb

Class Method Summary collapse

Class Method Details

.[](key) ⇒ Object

shortcut for accessing NimbleNodes.settings[key]



8
9
10
# File 'lib/nimble_nodes/dynos.rb', line 8

def self.[](key)
  NimbleNodes::Dynos.settings[key]
end

.maxObject



25
26
27
# File 'lib/nimble_nodes/dynos.rb', line 25

def self.max
  NimbleNodes::Dynos['max']
end

.max_request_queueObject



38
39
40
# File 'lib/nimble_nodes/dynos.rb', line 38

def self.max_request_queue
  NimbleNodes::Dynos.request_queue['max']
end

.minObject



21
22
23
# File 'lib/nimble_nodes/dynos.rb', line 21

def self.min
  NimbleNodes::Dynos['min']
end

.min_request_queueObject



34
35
36
# File 'lib/nimble_nodes/dynos.rb', line 34

def self.min_request_queue
  NimbleNodes::Dynos.request_queue['min']
end

.monitor(env) ⇒ Object

pass over the hash containing Rack env variables a Report will be created and posted if neccessary



57
58
59
60
61
62
63
64
# File 'lib/nimble_nodes/dynos.rb', line 57

def self.monitor(env)
  begin
    report = NimbleNodes::Report.new(env)
    report.post if report.post?
  rescue
    # rescues any possible errors to ensure app performace isn't affected
  end
end

.monitor?Boolean

Monitoring

Returns:

  • (Boolean)


50
51
52
# File 'lib/nimble_nodes/dynos.rb', line 50

def self.monitor?
  NimbleNodes.active? and !NimbleNodes::Dynos.paused?
end

.paused?Boolean

Status Inspector

Returns:

  • (Boolean)


44
45
46
# File 'lib/nimble_nodes/dynos.rb', line 44

def self.paused?
  not NimbleNodes::Dynos['paused_at'].nil? 
end

.request_queueObject



29
30
31
32
# File 'lib/nimble_nodes/dynos.rb', line 29

def self.request_queue
  hash = NimbleNodes::Dynos.settings['request_queue']
  hash.nil? ? {} : hash
end

.settingsObject



12
13
14
15
# File 'lib/nimble_nodes/dynos.rb', line 12

def self.settings
  hash = NimbleNodes::Settings['dynos_pool']
  hash.nil? ? {} : hash
end

.sizeObject



17
18
19
# File 'lib/nimble_nodes/dynos.rb', line 17

def self.size
  NimbleNodes::Dynos['size']
end