resque-population-control 0.4.0 → 0.5.0

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: 4c479293957e554a99b6d9eaee204547149bc2bc
4
- data.tar.gz: ea106605ddf5dcb92f4707c073016c0ca18b41cf
3
+ metadata.gz: ea47539d34c221eefa4ef20c569bc0720eaa4ce1
4
+ data.tar.gz: b5fb7db383b5a98cc72c3c0c8820aa2178d56668
5
5
  SHA512:
6
- metadata.gz: 1d0d7928de244a58296757f893a32da9a3c9ce4865c373113abca921b36cc8c97813910a6c0d891764a7103f391433d92703f42c77ac40fe2c8b041269bf9b0b
7
- data.tar.gz: 88624ec32e93f3b3bfc74c47020e2a5605fd9caa6c3ff497d5197c28f29c4b26bbfce12961d8846a008e0322aa8f0e58686e816a327cf6a27c17a7e73fe1f049
6
+ metadata.gz: 107c994c9fead4b480605583aa8d9ae61a641e0164e30b0920cff849ded7ec3b96e08b18a4a2ec4230d4648be580739a6bcbd73eae13441e387d1cfbb58ea7c0
7
+ data.tar.gz: 7edd7ae9f35c7280ef2a2fe23dab1306fcd980b2de992aa9da57627eb473ff1e275a52af7621f391e26f87e8b1b34c06ebb965ccdbbbcb570daddd7847906a83
@@ -1,7 +1,7 @@
1
1
  module Resque
2
2
  module Plugins
3
3
  module PopulationControl
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
5
5
 
6
6
  class PopulationExceeded < ::StandardError; end;
7
7
 
@@ -11,7 +11,11 @@ module Resque
11
11
  end
12
12
 
13
13
  def population_controlled?
14
- population_control_redis.get(population_control_cache_key).to_i <= population_control_max
14
+ population_control_count <= population_control_max
15
+ end
16
+
17
+ def max_population?
18
+ population_control_count >= population_control_max
15
19
  end
16
20
 
17
21
  def before_enqueue *args
@@ -44,6 +48,10 @@ module Resque
44
48
  population_control_redis.set population_control_cache_key, 0 if population_control_redis.decr(population_control_cache_key) <= 0
45
49
  end
46
50
 
51
+ def population_control_count
52
+ population_control_redis.get(population_control_cache_key).to_i
53
+ end
54
+
47
55
  def population_control_redis
48
56
  @population_control_redis ||= Resque.redis.redis
49
57
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-population-control
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Misha Conway