our-eel-hacks 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -99,8 +99,10 @@ module OurEelHacks
99
99
  errors << "No heroku api key set" if @heroku_api_key.nil?
100
100
  errors << "No app name set" if @app_name.nil?
101
101
  errors << "No process type set" if @ps_type.nil?
102
- logger.warn{ "Problems configuring Autoscaler: #{errors.inspect}" }
103
- raise "OurEelHacks::Autoscaler, configuration problem: " + errors.join(", ") unless errors.empty?
102
+ unless errors.empty?
103
+ logger.warn{ "Problems configuring Autoscaler: #{errors.inspect}" }
104
+ raise "OurEelHacks::Autoscaler, configuration problem: " + errors.join(", ")
105
+ end
104
106
  end
105
107
 
106
108
  attr_accessor :min_dynos, :max_dynos, :lower_limits, :upper_limits, :ps_type,
@@ -4,19 +4,24 @@ module OurEelHacks
4
4
  class Middleware
5
5
  def initialize(flavor)
6
6
  @flavor = flavor
7
+ @canary_string = "Canary: #{Time.now.to_s}"
7
8
  end
8
9
 
9
10
  protected
10
11
 
11
12
  def autoscale(metric)
12
13
  now = Time.now
14
+ canary = @canary_string.dup
13
15
  if @scaling_at.nil? or (now - @scaling_at) > 60
14
16
  @scaling_at = now
15
- trigger_scaling(metric)
17
+ trigger_scaling(metric, canary)
16
18
  end
17
19
  end
18
20
 
19
- def trigger_scaling(metric)
21
+ def trigger_scaling(metric, canary)
22
+ unless @canary_string == canary
23
+ raise "Canary died: #{@canary_string} != #{canary}"
24
+ end
20
25
  Autoscaler.instance_for(@flavor).scale(metric)
21
26
  @scaling_at = nil
22
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: our-eel-hacks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-05-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: corundum
16
- requirement: &75106820 !ruby/object:Gem::Requirement
16
+ requirement: &76439760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.0.1
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *75106820
24
+ version_requirements: *76439760
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: heroku
27
- requirement: &75138450 !ruby/object:Gem::Requirement
27
+ requirement: &76438690 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>'
@@ -34,7 +34,7 @@ dependencies:
34
34
  - 0
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *75138450
37
+ version_requirements: *76438690
38
38
  description: ! " Middleware for Rack and Sidekiq to scale heroku.\n\n A heroku process
39
39
  knows everything it needs in order to scale itself. A little configuration, and
40
40
  you're set.\n"
@@ -66,7 +66,7 @@ rdoc_options:
66
66
  - --main
67
67
  - doc/README
68
68
  - --title
69
- - our-eel-hacks-0.0.6 RDoc
69
+ - our-eel-hacks-0.0.7 RDoc
70
70
  require_paths:
71
71
  - lib/
72
72
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -77,7 +77,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
77
  version: '0'
78
78
  segments:
79
79
  - 0
80
- hash: 250928993
80
+ hash: 235543023
81
81
  required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  none: false
83
83
  requirements: