resque_stuck_queue 0.3.3 → 0.3.4

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
- SHA512:
3
- data.tar.gz: 6c8dd3d5b2ca90f0fd794199e5fdba0cb01b049787940b704d004792b2d9bbaddac99dfcb6ee1330cdacfa7ade687ecfaf120379afd281a49920f746ad7dac9b
4
- metadata.gz: 4794029e21d89246d8c4463015938144dce0e4c7bc1bc5e2e178ea6f96b6d51ade8fc6fbe34efe32d51967a5661c9365dc5b1cbcec5729966aeeb764bcfe6c1b
5
2
  SHA1:
6
- data.tar.gz: 0c9dd4826b15ffbd7cbf6621efd8ae6ed896cd13
7
- metadata.gz: 64a065870397ca03be56a44fdc67b2551be9bdea
3
+ metadata.gz: ff3a3dc45cf54e383a1fdc54140cd7a00f9a3914
4
+ data.tar.gz: 0d80baf43a00b1995d6805cf04059fe1c10d1a68
5
+ SHA512:
6
+ metadata.gz: a5ec94eb3aded1e0ca4999c27aa844593d73db41cc714c012f0ac0c067adfc6c670691e2c61c42839dd32c5bbeb7e84a1f1a7f63dda7766c1a1e52a1de2a5ab5
7
+ data.tar.gz: 836c6616ab7716710fd27e1cda3a1ceac824388166aeb215af989acda8f9ddbab7dbe955a35ddac4ff3eef94e3ee9f72ce74b46408be3978cc2ee28da753d085
@@ -5,7 +5,9 @@ module Resque
5
5
 
6
6
  attr_accessor :redis
7
7
 
8
- def perform(keyname)
8
+ def perform(*args)
9
+ keyname,host,port,namespace = args
10
+ Redis::Namespace.new(namespace, :redis => Redis.new(:host => host, :port => port))
9
11
  @redis.set(keyname, Time.now.to_i)
10
12
  end
11
13
 
@@ -1,5 +1,5 @@
1
1
  module Resque
2
2
  module StuckQueue
3
- VERSION = "0.3.3"
3
+ VERSION = "0.3.4"
4
4
  end
5
5
  end
@@ -3,6 +3,8 @@ require "resque_stuck_queue/config"
3
3
  require "resque_stuck_queue/heartbeat_job"
4
4
  require "resque_stuck_queue/signals"
5
5
 
6
+ require 'redis-namespace'
7
+
6
8
  # TODO move this require into a configurable?
7
9
  require 'resque'
8
10
 
@@ -26,7 +28,6 @@ module Resque
26
28
 
27
29
  def redis
28
30
  @redis ||= config[:redis]
29
- HeartbeatJob.redis = @redis
30
31
  end
31
32
 
32
33
  def heartbeat_key_for(queue)
@@ -142,7 +143,9 @@ module Resque
142
143
  config[:heartbeat_job].call
143
144
  else
144
145
  queues.each do |queue_name|
145
- Resque.enqueue_to(queue_name, HeartbeatJob, heartbeat_key_for(queue_name))
146
+ # Redis::Namespace.new support as well as Redis.new
147
+ namespace = redis.respond_to?(:namespace) ? redis.namespace : nil
148
+ Resque.enqueue_to(queue_name, HeartbeatJob, [heartbeat_key_for(queue_name), redis.client.host, redis.client.port, namespace ])
146
149
  end
147
150
  end
148
151
  end
@@ -20,7 +20,8 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_runtime_dependency "redis-mutex" # TODO rm this
22
22
 
23
+ spec.add_runtime_dependency "redis-namespace"
24
+
23
25
  spec.add_development_dependency "bundler", "~> 1.5"
24
26
  spec.add_development_dependency "rake"
25
- spec.add_development_dependency "redis-namespace"
26
27
  end
@@ -18,11 +18,6 @@ class TestResqueStuckQueue < Minitest::Test
18
18
  Resque::StuckQueue.config[:abort_on_exception] = true
19
19
  end
20
20
 
21
- def test_watcher_and_heartbeat_redis_are_the_same
22
- # to avoid namespace collisions
23
- assert_equal Resque::StuckQueue.redis, Resque::StuckQueue::HeartbeatJob.redis
24
- end
25
-
26
21
  def test_configure_heartbeat_key
27
22
  puts "#{__method__}"
28
23
  assert_nil Resque::StuckQueue.redis.get("it-is-configurable"), "global key should not be set"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque_stuck_queue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shai Rosenfeld
@@ -9,43 +9,43 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2014-01-30 00:00:00 Z
12
+ date: 2014-01-31 00:00:00 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis-mutex
16
16
  prerelease: false
17
17
  requirement: &id001 !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - &id003
19
+ - &id002
20
20
  - ">="
21
21
  - !ruby/object:Gem::Version
22
22
  version: "0"
23
23
  type: :runtime
24
24
  version_requirements: *id001
25
25
  - !ruby/object:Gem::Dependency
26
- name: bundler
26
+ name: redis-namespace
27
27
  prerelease: false
28
- requirement: &id002 !ruby/object:Gem::Requirement
28
+ requirement: &id003 !ruby/object:Gem::Requirement
29
29
  requirements:
30
- - - ~>
31
- - !ruby/object:Gem::Version
32
- version: "1.5"
33
- type: :development
34
- version_requirements: *id002
30
+ - *id002
31
+ type: :runtime
32
+ version_requirements: *id003
35
33
  - !ruby/object:Gem::Dependency
36
- name: rake
34
+ name: bundler
37
35
  prerelease: false
38
36
  requirement: &id004 !ruby/object:Gem::Requirement
39
37
  requirements:
40
- - *id003
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: "1.5"
41
41
  type: :development
42
42
  version_requirements: *id004
43
43
  - !ruby/object:Gem::Dependency
44
- name: redis-namespace
44
+ name: rake
45
45
  prerelease: false
46
46
  requirement: &id005 !ruby/object:Gem::Requirement
47
47
  requirements:
48
- - *id003
48
+ - *id002
49
49
  type: :development
50
50
  version_requirements: *id005
51
51
  description: where the wild things are. err, when resque gets stuck
@@ -93,10 +93,10 @@ require_paths:
93
93
  - lib
94
94
  required_ruby_version: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - *id003
96
+ - *id002
97
97
  required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - *id003
99
+ - *id002
100
100
  requirements: []
101
101
 
102
102
  rubyforge_project: