resque_stuck_queue 0.3.7 → 0.3.8

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
- SHA1:
3
- data.tar.gz: 24838251cf63913fd05a55753101def684df1a4f
4
- metadata.gz: 3d158d30adce28f9d8cde9ea0e26e7af7309c03a
5
2
  SHA512:
6
- data.tar.gz: 6765964aa3fd134a04682037125b45f680d9263221ca7c58d40791ad286a33fd3a3330b39ae1df51ad73f49dd480ecd8b8b990b46360205827af88d75c272122
7
- metadata.gz: 2fe9d2eadd44d70d24ab2bc2fa18eae87b159f1b30372e7968b7e0c4a04fc43a069b8fe35e4b512101f37056c3535302ce02dd0d6395871aa48db129d739157c
3
+ metadata.gz: 73fe098253c3537faa8c3f52ba8725f5bb3b61de0e3ab592cf2f6de6eedbcf2e5bc92f3c356fac8e32fe6f383104621432ac62983af8c29c72b2ba1f2d4faebb
4
+ data.tar.gz: 3a2e165f4e3edc91cc6086c3180250ea5970e42695e3aede09049918ba771206e905ceac6956b94a72bf925709703b5f5bc2964edd9a3bb4c266c64e65e60e14
5
+ SHA1:
6
+ metadata.gz: 9248a893ba7d98a4e4b057f19cc2592babc83993
7
+ data.tar.gz: 9b3208761e51d8065c9e07e9f300085693ea3b67
@@ -8,8 +8,9 @@ module Resque
8
8
  def perform(*args)
9
9
  keyname,host,port,namespace,new_time = *args
10
10
  @redis = Redis::Namespace.new(namespace, :redis => Redis.new(:host => host, :port => port))
11
+ #raise "#{@redis.inspect} must be the same as #{Resque::StuckQueue.redis.inspect}"
11
12
  @redis.set(keyname, new_time)
12
- Resque::StuckQueue.logger.info "successfully updated key #{keyname} to #{new_time} at #{Time.now}"
13
+ Resque::StuckQueue.logger.info "successfully updated key #{keyname} to #{new_time} at #{Time.now} for #{@redis.inspect}"
13
14
  end
14
15
 
15
16
  end
@@ -1,5 +1,5 @@
1
1
  module Resque
2
2
  module StuckQueue
3
- VERSION = "0.3.7"
3
+ VERSION = "0.3.8"
4
4
  end
5
5
  end
@@ -77,6 +77,8 @@ module Resque
77
77
 
78
78
  Redis::Classy.db = redis if Redis::Classy.db.nil?
79
79
 
80
+ pretty_process_name
81
+
80
82
  setup_heartbeat_thread
81
83
  setup_watcher_thread
82
84
 
@@ -180,6 +182,7 @@ module Resque
180
182
  if time_set
181
183
  time_set
182
184
  else
185
+ logger.info("manually refreshing #{queue_name} for :first_time")
183
186
  manual_refresh(queue_name, :first_time)
184
187
  end.to_i
185
188
  end
@@ -266,6 +269,11 @@ module Resque
266
269
  def max_wait_time
267
270
  config[:trigger_timeout] || TRIGGER_TIMEOUT
268
271
  end
272
+
273
+ def pretty_process_name
274
+ $0 = "rake --trace resque:stuck_queue #{redis.inspect} QUEUES=#{queues.join(",")}"
275
+ end
276
+
269
277
  end
270
278
  end
271
279
  end
data/test/test_helper.rb CHANGED
@@ -26,7 +26,7 @@ module TestHelper
26
26
 
27
27
  def hax_kill_resque
28
28
  # ugly, FIXME how to get pid of forked forked process. run_resque pid is incorrect.
29
- `ps aux |grep resque |awk '{print $2}' |xargs kill`
29
+ `ps aux |grep resque | grep -v stuck_queue |awk '{print $2}' |xargs kill`
30
30
  sleep 2 # wait for shutdown
31
31
  end
32
32
 
@@ -38,3 +38,13 @@ module TestHelper
38
38
  end
39
39
 
40
40
  end
41
+
42
+ # http://stackoverflow.com/questions/9346101/how-to-get-stack-trace-from-a-testunittestcase
43
+ def MiniTest.filter_backtrace(bt)
44
+ bt
45
+ end
46
+
47
+ # hax ensure previous test runs that raised didn't leave a resque process runing beforehand
48
+ unless @before_all_hax_kill_resque
49
+ TestHelper.hax_kill_resque && @before_all_hax_kill_resque=true
50
+ end
@@ -58,6 +58,8 @@ class TestIntegration < Minitest::Test
58
58
  with_no_resque_failures do
59
59
  Resque::StuckQueue.config[:trigger_timeout] = 10
60
60
  Resque::StuckQueue.config[:heartbeat] = 1
61
+ Resque::StuckQueue.config[:redis] = Redis.new
62
+
61
63
  @triggered = false
62
64
  Resque::StuckQueue.config[:triggered_handler] = proc { @triggered = true }
63
65
  start_and_stop_loops_after(5)
@@ -72,6 +74,8 @@ class TestIntegration < Minitest::Test
72
74
  with_no_resque_failures do
73
75
  Resque::StuckQueue.config[:trigger_timeout] = 0
74
76
  Resque::StuckQueue.config[:heartbeat] = 1
77
+ Resque::StuckQueue.config[:redis] = Redis.new
78
+
75
79
  @triggered = false
76
80
  Resque::StuckQueue.config[:triggered_handler] = proc { @triggered = true }
77
81
  start_and_stop_loops_after(2)
@@ -86,7 +90,7 @@ class TestIntegration < Minitest::Test
86
90
  with_no_resque_failures do
87
91
  Resque::StuckQueue.config[:trigger_timeout] = 2 # won't allow waiting too much and will complain (eg trigger) sooner than later
88
92
  Resque::StuckQueue.config[:heartbeat] = 1
89
- Resque::StuckQueue.config[:redis] = Redis::Namespace.new(nil, :redis => Redis.new)
93
+ Resque::StuckQueue.config[:redis] = Redis.new
90
94
 
91
95
  begin
92
96
  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.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shai Rosenfeld
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2014-01-31 00:00:00 Z
12
+ date: 2014-02-01 00:00:00 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis-mutex