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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/heroku-resque-workers-scaler/scaler.rb +13 -13
- data/lib/heroku-resque-workers-scaler/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c961a70660acefe4fe1942406fee5acb418be592
|
4
|
+
data.tar.gz: 3f4947d5a7ab4c012dd790c5f8501c8bf9f5eb71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91c78eae89d912338dc20d291ef9f447a5b341382ce8af3bd954d396fbe6d9c723432a4816595c7f636acc90bb18f703587959e82be1b4d35874216ed4f7ca75
|
7
|
+
data.tar.gz: cd580a824145cf8a6d0da0f11fdda4836c832c87c8d470f5d59c65a915f13e8fc5bfd2caa0189be63fdd8d5e2b1a0b7d908ee32ef5f9f8d5e369cf92c4739827
|
data/CHANGELOG.md
CHANGED
@@ -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.
|
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
|
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.
|
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-
|
12
|
+
date: 2014-09-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: resque
|