heroku-resque-workers-scaler 0.3.2 → 0.3.3
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/config/scaler_config.yml +1 -0
- data/lib/heroku-resque-workers-scaler/config.rb +5 -1
- data/lib/heroku-resque-workers-scaler/scaler.rb +6 -0
- data/lib/heroku-resque-workers-scaler/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ebc5fbf7a57ecccea74a9a3d33b74c18b5246532
|
|
4
|
+
data.tar.gz: 1ee751a12ffb717e1368f2f48fb893b8695e2274
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3735773c66efba949db6aa37cc0c18831f985faeb4af4e988dd3d073f8ca9e14d4308afe875fb16027e17f5f95b26bd386b666dad8d562d7f9bfc00540897393
|
|
7
|
+
data.tar.gz: fe080b2464899adf0248d3a6f38bde6dea2e3bf8dbc1fb55324b21c022a7c62fa45744e8cbb9520127d79172fe8c7b7afc68c23374afaa54605843d6fcf02ae0
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -77,6 +77,7 @@ Exmple YAML file contents:
|
|
|
77
77
|
environments:
|
|
78
78
|
- production
|
|
79
79
|
worker_name: resque
|
|
80
|
+
threshold: 100
|
|
80
81
|
|
|
81
82
|
if you use `mode: :fit` the number of job is exactly the same of available worker, `:half` the number of worker is 1/2 of number of job in queue, and for `third` 1/3
|
|
82
83
|
|
data/config/scaler_config.yml
CHANGED
|
@@ -5,11 +5,15 @@ module HerokuResqueAutoScale
|
|
|
5
5
|
extend self
|
|
6
6
|
|
|
7
7
|
CONFIG_FILE_NAME = 'scaler_config.yml'
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
def mode
|
|
10
10
|
@mode ||= config['mode']
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
+
def threshold
|
|
14
|
+
@threshold ||= config['threshold']
|
|
15
|
+
end
|
|
16
|
+
|
|
13
17
|
def thresholds
|
|
14
18
|
@thresholds ||= config['thresholds']
|
|
15
19
|
end
|
|
@@ -21,6 +21,8 @@ module HerokuResqueAutoScale
|
|
|
21
21
|
if safe_mode?
|
|
22
22
|
if scale_down? quantity
|
|
23
23
|
return false unless all_jobs_have_been_processed?
|
|
24
|
+
else
|
|
25
|
+
return false if too_many_workers_asked?(quantity)
|
|
24
26
|
end
|
|
25
27
|
end
|
|
26
28
|
|
|
@@ -52,6 +54,10 @@ module HerokuResqueAutoScale
|
|
|
52
54
|
quantity < workers
|
|
53
55
|
end
|
|
54
56
|
|
|
57
|
+
def too_many_workers_asked? quantity
|
|
58
|
+
quantity >= Config.threshold
|
|
59
|
+
end
|
|
60
|
+
|
|
55
61
|
def safe_mode?
|
|
56
62
|
ENV['SAFE_MODE'] and ENV['SAFE_MODE'] == 'true'
|
|
57
63
|
end
|