resque-one 1.0.1 → 1.1.0

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
  SHA256:
3
- metadata.gz: cf1615b9a144ec043dccfbb6a6600f23d247f0da33fed1ed40e721260a88d5a1
4
- data.tar.gz: 4d0f29a1e56ca45d4ee38fc884ca74b856cddfff8134cab44fe88062037c6d9f
3
+ metadata.gz: 7cc0d277c8cf33ee79f76f0d29c70b362514fb36cc4acf7a7af904045bf15ed1
4
+ data.tar.gz: 935c173c909a9d4382eb8e765220923603e8d78c50f755190c33370970fa35fc
5
5
  SHA512:
6
- metadata.gz: 962001d312748ef6504b3d97473a9389395cc1da343e12d3a8061d3bbfcad00dc797253fed2a35d2dd3c82db3e86203ace6ae7344f1a3ffb12a329789e5e62e8
7
- data.tar.gz: a9e7a9ebd60a400d6ea47c165baafc1c6f6e3b7dbebc0b43cbbe9f827b3c88cf543cef3b3e4cb0c7cfb0b0c31dd9e2e65a01057b6280f26051b05de0bfcaf629
6
+ metadata.gz: 6655a09c5e914183c4228d2d5ea066b1ab6950841b7a6e06ac3c29836d6ffe9c1e078e639528d9c55b5cc9e96d553238a7ae3b95eedb6298f41adfd8d9711072
7
+ data.tar.gz: 1f835e39995466f159f7f9305a7a999f4e1e39b7f41512a51859d7b0a58fc3d4b07be0e159b1fea3c2dfa2ae6496af697041f7a4af96b9ff99a9de60bf2cfeea
@@ -2,8 +2,6 @@ module Resque
2
2
  module One
3
3
  class QueueLocker
4
4
 
5
- PREFIX = 'resque-one'.freeze
6
-
7
5
  attr_reader :redis, :queue
8
6
 
9
7
  def initialize(redis, queue)
@@ -20,6 +18,7 @@ module Resque
20
18
 
21
19
  job_key = key_for job_info
22
20
  redis.set job_key, job_info.id
21
+ redis.expire job_key, Resque::One.lock_ttl if Resque::One.lock_ttl
23
22
 
24
23
  true
25
24
  end
@@ -30,7 +29,7 @@ module Resque
30
29
 
31
30
  def unlock_all(klass=nil)
32
31
  filter = klass ? "#{queue_key}:#{klass.to_s}:*" : "#{queue_key}:*"
33
- redis.keys(filter).each do |key|
32
+ redis.scan_each(match: filter, count: Resque::One.scan_count) do |key|
34
33
  redis.del key
35
34
  end
36
35
  end
@@ -38,7 +37,7 @@ module Resque
38
37
  private
39
38
 
40
39
  def queue_key
41
- "#{PREFIX}:#{queue}"
40
+ "#{Resque::One.keyspace}:#{queue}"
42
41
  end
43
42
 
44
43
  def key_for(job_info)
@@ -1,5 +1,5 @@
1
1
  module Resque
2
2
  module One
3
- VERSION = '1.0.1'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
data/lib/resque/one.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'resque'
2
2
  require 'consty'
3
+ require 'class_config'
3
4
  require_relative 'one/version'
4
5
  require_relative 'one/job_info'
5
6
  require_relative 'one/queue_locker'
@@ -8,4 +9,12 @@ require_relative 'plugins/one'
8
9
 
9
10
  module Resque
10
11
  extend One::ResqueExt
12
+
13
+ module One
14
+ extend ClassConfig
15
+
16
+ attr_config :keyspace, 'resque-one'
17
+ attr_config :scan_count, 1000
18
+ attr_config :lock_ttl
19
+ end
11
20
  end
data/resque-one.gemspec CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_runtime_dependency 'resque', '~> 1.25'
23
23
  spec.add_runtime_dependency 'consty', '~> 1.0'
24
+ spec.add_runtime_dependency 'class_config', '~> 0.0'
24
25
 
25
26
  spec.add_development_dependency 'resque-status', '~> 0.5'
26
27
  spec.add_development_dependency 'rake', '~> 11.0'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-one
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel Naiman
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: class_config
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: resque-status
43
57
  requirement: !ruby/object:Gem::Requirement