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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: efa38945abda66ac4437e22e798c4d1ea5c0f509
4
- data.tar.gz: 22c4ef84b8513b1b754307e3c218a72f3d974eb4
3
+ metadata.gz: ebc5fbf7a57ecccea74a9a3d33b74c18b5246532
4
+ data.tar.gz: 1ee751a12ffb717e1368f2f48fb893b8695e2274
5
5
  SHA512:
6
- metadata.gz: 99fa871c0636ac0ed002f74aabf23541d4048f1760cd43464ee8295ef2300fa2a63dc540369ca396d04842135f748ce3f1b94242ad9f5b233b9b43ede89990ee
7
- data.tar.gz: 11169dd797bfeeda137c4f1085390a0158095a4bda68cefa6b3bb6a4c7593b3a293c54033870be87a94b517e9ff470c7ca5118475bdd5441d5331c9679c0d36a
6
+ metadata.gz: 3735773c66efba949db6aa37cc0c18831f985faeb4af4e988dd3d073f8ca9e14d4308afe875fb16027e17f5f95b26bd386b666dad8d562d7f9bfc00540897393
7
+ data.tar.gz: fe080b2464899adf0248d3a6f38bde6dea2e3bf8dbc1fb55324b21c022a7c62fa45744e8cbb9520127d79172fe8c7b7afc68c23374afaa54605843d6fcf02ae0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # Changelog VERSION = '0.3.3'
2
+
3
+ * feature
4
+ * Add max of workers can you be ask
5
+
6
+ [Fullcahnges](https://github.com/joel/heroku-resque-workers-scaler/pull/11)
7
+
1
8
  # Changelog VERSION = '0.3.2'
2
9
 
3
10
  * bug fix
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- heroku-resque-workers-scaler (0.3.2)
4
+ heroku-resque-workers-scaler (0.3.3)
5
5
  platform-api (~> 0.2.0)
6
6
  resque (~> 1.25.2)
7
7
 
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
 
@@ -15,3 +15,4 @@ environments:
15
15
  - staging
16
16
  - development
17
17
  worker_name: worker
18
+ threshold: 100
@@ -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
@@ -1,3 +1,3 @@
1
1
  module HerokuResqueAutoScale
2
- VERSION = '0.3.2'
2
+ VERSION = '0.3.3'
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.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Quezada