heroku-resque-workers-scaler 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 822db588c29eaa4af70a831e710bf290e891ff32
4
- data.tar.gz: 7fed104ac4aa64a5bebd1bf0ad9a1633a7b83e0f
3
+ metadata.gz: c961a70660acefe4fe1942406fee5acb418be592
4
+ data.tar.gz: 3f4947d5a7ab4c012dd790c5f8501c8bf9f5eb71
5
5
  SHA512:
6
- metadata.gz: 671cfa87d47c09521dea162a99a976295c1edf8ef45880d3760c2e4eefe068e8e44ba3024e36b9c3de99e9b24cc16a650ac75cff55f189b9be30a8d2ab781351
7
- data.tar.gz: 0b2daa724eaf64a96bb94b91fcda4e1d01eb1c6490c672414902b3247913acb008607b385f910988f82c4f50d12eecaf1066d6ca3e6ebb6781ea966b237b68fe
6
+ metadata.gz: 91c78eae89d912338dc20d291ef9f447a5b341382ce8af3bd954d396fbe6d9c723432a4816595c7f636acc90bb18f703587959e82be1b4d35874216ed4f7ca75
7
+ data.tar.gz: cd580a824145cf8a6d0da0f11fdda4836c832c87c8d470f5d59c65a915f13e8fc5bfd2caa0189be63fdd8d5e2b1a0b7d908ee32ef5f9f8d5e369cf92c4739827
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # Changelog VERSION = '0.1.9'
2
+
3
+ [Fullcahnges](https://github.com/joel/heroku-resque-workers-scaler/pull/5)
4
+
1
5
  # Changelog VERSION = '0.1.8'
2
6
 
3
7
  [Fullcahnges](https://github.com/joel/heroku-resque-workers-scaler/pull/4)
@@ -2,12 +2,12 @@ require 'heroku-api'
2
2
 
3
3
  module HerokuResqueAutoScale
4
4
  module Scaler
5
-
5
+
6
6
  class << self
7
7
  @@heroku = Heroku::API.new(api_key: ENV['HEROKU_API_KEY'])
8
-
8
+
9
9
  def workers
10
- return nil unless authorised?
10
+ return nil unless authorised?
11
11
  @@heroku.get_app(ENV['HEROKU_APP_NAME']).body['workers'].to_i
12
12
  end
13
13
 
@@ -16,7 +16,7 @@ module HerokuResqueAutoScale
16
16
  if safe_mode? and down? qty
17
17
  return unless safer?
18
18
  end
19
- @@heroku.post_ps_scale(ENV['HEROKU_APP_NAME'], 'worker', qty.to_s)
19
+ @@heroku.post_ps_scale(ENV['HEROKU_APP_NAME'], 'worker', qty.to_i)
20
20
  end
21
21
 
22
22
  def job_count
@@ -26,27 +26,27 @@ module HerokuResqueAutoScale
26
26
  def working_job_count
27
27
  Resque.info[:working].to_i
28
28
  end
29
-
29
+
30
30
  protected
31
-
31
+
32
32
  def down? qty
33
- qty < workers
33
+ qty < workers
34
34
  end
35
-
35
+
36
36
  def safe_mode?
37
37
  ENV['SAFE_MODE'] and ENV['SAFE_MODE'] == 'true'
38
38
  end
39
-
39
+
40
40
  def safer?
41
41
  job_count + working_job_count == 0
42
42
  end
43
-
43
+
44
44
  private
45
-
45
+
46
46
  def authorised?
47
47
  HerokuResqueAutoScale::Config.environments.include? Rails.env.to_s
48
48
  end
49
-
49
+
50
50
  end
51
51
  end
52
52
 
@@ -73,7 +73,7 @@ module HerokuResqueAutoScale
73
73
  end
74
74
  end
75
75
  end
76
-
76
+
77
77
  private
78
78
 
79
79
  def scale_down
@@ -1,3 +1,3 @@
1
1
  module HerokuResqueAutoScale
2
- VERSION = '0.1.8'
2
+ VERSION = '0.1.9'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku-resque-workers-scaler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Quezada
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-11 00:00:00.000000000 Z
12
+ date: 2014-09-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: resque