resque_stuck_queue 0.3.5 → 0.3.6

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
- SHA1:
3
- data.tar.gz: cfbe93e242cdb25b7d6783cbe4fe4ae43f3e55c0
4
- metadata.gz: a1e36f35d1b8e95afb3102b67bc1e28234d2bd4f
5
2
  SHA512:
6
- data.tar.gz: b3ff34bf049f1ffd625da524797ee7a7405cd63c0b93da7c5bbc14a921b0326ce9a22d1475d399cf612fe75f807cdd646166af9a2ca7126f6150dcd6913cd7a0
7
- metadata.gz: d77c76164663b195c3e686104354109290360ba2deb8fa4f9f91cbd4634747e17f09e12ac24fb845ad310a307b1f5ffbd7bc68f089b87966781ef954981adce0
3
+ data.tar.gz: 2055181649b94897f6bfc18817199a35bf9a0324042da9a6ed15653bea22d459a7e5ba062ec57294c557d0ed2ab04df418bdce4b01f53e39ecae6771e7a39e16
4
+ metadata.gz: 3fe6ae6af383d55311d5075d85b86b73fe2955c3f7149ab23c5e0adf61a999b4fdd706951efc3e39594786c0f4c20e3208c4037f9e705fe97ac301e4f04edca4
5
+ SHA1:
6
+ data.tar.gz: 3a99f92f2847757bb1db57e7c62bc80bc430f2c4
7
+ metadata.gz: 940d63172246826ea3fbf12d883ecf44a5f76e53
data/Rakefile CHANGED
@@ -17,6 +17,8 @@ task :'resque:setup' do
17
17
  # https://github.com/resque/resque/issues/773
18
18
  # have the jobs loaded in memory
19
19
  Dir["./test/resque/*.rb"].each {|file| require file}
20
+ # load project
21
+ Dir["./lib/resque_stuck_queue.rb"].each {|file| require file}
20
22
  end
21
23
 
22
24
  require 'resque_scheduler/tasks'
@@ -145,7 +145,7 @@ module Resque
145
145
  queues.each do |queue_name|
146
146
  # Redis::Namespace.new support as well as Redis.new
147
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 ])
148
+ Resque.enqueue_to(queue_name, HeartbeatJob, heartbeat_key_for(queue_name), redis.client.host, redis.client.port, namespace )
149
149
  end
150
150
  end
151
151
  end
@@ -6,9 +6,10 @@ module Resque
6
6
  attr_accessor :redis
7
7
 
8
8
  def perform(*args)
9
- keyname,host,port,namespace = args
9
+ keyname,host,port,namespace = *args
10
10
  @redis = Redis::Namespace.new(namespace, :redis => Redis.new(:host => host, :port => port))
11
11
  @redis.set(keyname, Time.now.to_i)
12
+ Resque::StuckQueue.logger.info "successfully updated key #{keyname}"
12
13
  end
13
14
 
14
15
  end
@@ -1,5 +1,5 @@
1
1
  module Resque
2
2
  module StuckQueue
3
- VERSION = "0.3.5"
3
+ VERSION = "0.3.6"
4
4
  end
5
5
  end
data/test/test_helper.rb CHANGED
@@ -13,7 +13,7 @@ module TestHelper
13
13
  extend self
14
14
 
15
15
  def run_resque(queue_name = "*")
16
- pid = fork { exec("export QUEUE=#{queue_name}; bundle exec rake --trace resque:work") }
16
+ pid = fork { exec("export INTERVAL=1 QUEUE=#{queue_name}; bundle exec rake --trace resque:work") }
17
17
  sleep 3 # wait for resque to boot up
18
18
  pid
19
19
  end
@@ -55,6 +55,7 @@ class TestIntegration < Minitest::Test
55
55
  def test_resque_enqueues_a_job_does_not_trigger
56
56
  puts "#{__method__}"
57
57
 
58
+ Resque::Failure.clear
58
59
  Resque::StuckQueue.config[:trigger_timeout] = 10
59
60
  Resque::StuckQueue.config[:heartbeat] = 1
60
61
  @triggered = false
@@ -62,9 +63,8 @@ class TestIntegration < Minitest::Test
62
63
  start_and_stop_loops_after(5)
63
64
  Resque::StuckQueue.redis.del(SetRedisKey::NAME)
64
65
  Resque.enqueue_to(:app, SetRedisKey)
65
- sleep 3
66
- #assert_equal Resque::StuckQueue.redis.get(SetRedisKey::NAME), "1" # transient failure: resque picks up jobs at unpredectiple times?
67
- # job ran successfully, so don't trigger
66
+ sleep 3 # job ran successfully, so don't trigger
67
+ assert_nil Resque::Failure.all, "Resque hearbeat job cant fail: #{Resque::Failure.all.inspect}"
68
68
  assert_equal @triggered, false
69
69
  end
70
70
 
@@ -85,6 +85,7 @@ class TestIntegration < Minitest::Test
85
85
 
86
86
  Resque::StuckQueue.config[:trigger_timeout] = 2 # won't allow waiting too much and will complain (eg trigger) sooner than later
87
87
  Resque::StuckQueue.config[:heartbeat] = 1
88
+ Resque::StuckQueue.config[:redis] = Redis::Namespace.new(nil, :redis => Redis.new)
88
89
 
89
90
  begin
90
91
  Resque::StuckQueue.config[:heartbeat_job] = proc { Resque.enqueue_to(:app, Resque::StuckQueue::HeartbeatJob, Resque::StuckQueue.heartbeat_key_for(:app)) }
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.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shai Rosenfeld