resque-heroku-scaling-canary 0.1.6 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.6
1
+ 0.2.0
@@ -9,7 +9,7 @@ module Resque
9
9
  return if Config.scaling_disabled?
10
10
  n = self.respond_to?(:minimum_workers_needed) ? self.minimum_workers_needed : 1
11
11
  return if Config.heroku_client.info(Config.heroku_app)[:workers].to_i >= n
12
- Config.heroku_client.set_workers(Config.heroku_app, n)
12
+ Config.heroku_client.ps_scale(Config.heroku_app, :type => "worker", :qty => n)
13
13
  Resque.enqueue(CanaryJob, Config.polling_interval) if CanaryJob.canary_jobs_outstanding == 0
14
14
  end
15
15
 
@@ -12,7 +12,7 @@ module Resque
12
12
  Kernel.sleep Config.polling_interval
13
13
  after = self.non_canary_jobs_pending
14
14
  if before == after and before == 0
15
- Config.heroku_client.set_workers(Config.heroku_app, 0)
15
+ Config.heroku_client.ps_scale(Config.heroku_app, :type => "worker", :qty => 0)
16
16
  else
17
17
  Resque.enqueue(self, timeout)
18
18
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "resque-heroku-scaling-canary"
8
- s.version = "0.1.6"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Aaron Windsor"]
12
- s.date = "2012-02-24"
12
+ s.date = "2012-07-18"
13
13
  s.description = "Auto-scale Heroku workers for Resque"
14
14
  s.email = "aaron.windsor@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -36,20 +36,20 @@ describe Resque::Plugins::ScalingCanary do
36
36
 
37
37
  describe "after_enqueue_ensure_heroku_workers" do
38
38
  it "should scale workers up to 1 if no :minimum_workers_needed method is implemented" do
39
- @mock_heroku_client.should_receive(:set_workers).with("stub-app", 1).once
40
- @mock_heroku_client.should_receive(:set_workers).with("stub-app", 0).once
39
+ @mock_heroku_client.should_receive(:ps_scale).with("stub-app", :type => "worker", :qty => 1).once
40
+ @mock_heroku_client.should_receive(:ps_scale).with("stub-app", :type => "worker", :qty => 0).once
41
41
  @mock_heroku_client.stub(:info) { {:workers => 0} }
42
42
  Resque.enqueue SmallBatchJob
43
43
  end
44
44
  it "should scale workers up to the number specified by :minimum_workers_needed if an implementation is provided" do
45
- @mock_heroku_client.should_receive(:set_workers).with("stub-app", 20).once
46
- @mock_heroku_client.should_receive(:set_workers).with("stub-app", 0).once
45
+ @mock_heroku_client.should_receive(:ps_scale).with("stub-app", :type => "worker", :qty => 20).once
46
+ @mock_heroku_client.should_receive(:ps_scale).with("stub-app", :type => "worker", :qty => 0).once
47
47
  @mock_heroku_client.stub(:info) { {:workers => 0} }
48
48
  Resque.enqueue LargeBatchJob
49
49
  end
50
50
  it "should not scale workers at all if scaling is disabled" do
51
51
  Resque::Plugins::ScalingCanary::Config.disable_scaling_if{ true }
52
- @mock_heroku_client.stub(:set_workers){ raise "Not expecting call to :set_workers because scaling is disabled" }
52
+ @mock_heroku_client.stub(:ps_scale){ raise "Not expecting call to :ps_scale because scaling is disabled" }
53
53
  @mock_heroku_client.stub(:info) { {:workers => 0} }
54
54
  Resque.enqueue LargeBatchJob
55
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-heroku-scaling-canary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-24 00:00:00.000000000Z
12
+ date: 2012-07-18 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: resque
16
- requirement: &2155376560 !ruby/object:Gem::Requirement
16
+ requirement: &2164040160 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.9'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2155376560
24
+ version_requirements: *2164040160
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: heroku
27
- requirement: &2155376080 !ruby/object:Gem::Requirement
27
+ requirement: &2164039660 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '2.18'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2155376080
35
+ version_requirements: *2164039660
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &2155375600 !ruby/object:Gem::Requirement
38
+ requirement: &2164039100 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '2.7'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2155375600
46
+ version_requirements: *2164039100
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rspec-mocks
49
- requirement: &2155375120 !ruby/object:Gem::Requirement
49
+ requirement: &2164038600 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '2.7'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2155375120
57
+ version_requirements: *2164038600
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: jeweler
60
- requirement: &2155374640 !ruby/object:Gem::Requirement
60
+ requirement: &2164038100 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: 1.6.4
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2155374640
68
+ version_requirements: *2164038100
69
69
  description: Auto-scale Heroku workers for Resque
70
70
  email: aaron.windsor@gmail.com
71
71
  executables: []
@@ -102,7 +102,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
102
102
  version: '0'
103
103
  segments:
104
104
  - 0
105
- hash: -1700123965742266632
105
+ hash: -4033217612349808839
106
106
  required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  none: false
108
108
  requirements: