heroku-autoscale 0.2.1 → 0.2.2
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.
- data/lib/heroku/autoscale.rb +4 -2
- data/spec/heroku/autoscale_spec.rb +1 -1
- metadata +3 -3
data/lib/heroku/autoscale.rb
CHANGED
@@ -5,7 +5,7 @@ require "rack"
|
|
5
5
|
module Heroku
|
6
6
|
class Autoscale
|
7
7
|
|
8
|
-
VERSION = "0.2.
|
8
|
+
VERSION = "0.2.2"
|
9
9
|
|
10
10
|
attr_reader :app, :options, :last_scaled
|
11
11
|
|
@@ -29,6 +29,9 @@ module Heroku
|
|
29
29
|
private ######################################################################
|
30
30
|
|
31
31
|
def autoscale(env)
|
32
|
+
# dont do anything if we scaled too frequently ago
|
33
|
+
return if (Time.now - last_scaled) < options[:min_frequency]
|
34
|
+
|
32
35
|
original_dynos = dynos = current_dynos
|
33
36
|
wait = queue_wait(env)
|
34
37
|
|
@@ -74,7 +77,6 @@ private ######################################################################
|
|
74
77
|
end
|
75
78
|
|
76
79
|
def set_dynos(count)
|
77
|
-
return if (Time.now - last_scaled) < options[:min_frequency]
|
78
80
|
heroku.set_dynos(options[:app_name], count)
|
79
81
|
@last_scaled = Time.now
|
80
82
|
end
|
@@ -85,7 +85,7 @@ describe Heroku::Autoscale do
|
|
85
85
|
|
86
86
|
it "doesnt flap" do
|
87
87
|
heroku = mock(Heroku::Client)
|
88
|
-
heroku.info("test_app_name").
|
88
|
+
heroku.info("test_app_name").once { { :dynos => 5 } }
|
89
89
|
heroku.set_dynos.with_any_args.once
|
90
90
|
|
91
91
|
mock(app).heroku.times(any_times) { heroku }
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroku-autoscale
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- David Dollar
|