resque_stuck_queue 0.3.1 → 0.3.2

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
  SHA512:
3
- metadata.gz: 3299f1414066a4a5e91b4f94316c3ca713f8d2572fd100e13f5fef8a0a3f7ef3cb72b1522d31a240482e8aad3d828d9dffb858292d89794846809408ef726035
4
- data.tar.gz: e9d59367e304be737b9c6d9f28a3320e653f9ffc7e72f78f403998ae18f586df7069d58d221298b2686f77d99b5e3b68ab9e6f42d0c655220ec7d5155676d1a9
3
+ metadata.gz: 10c4e2a06e531a2314e34594fc296603319afd0cb296d5155284a7d25644935c874f52eeed4438c098c8a87506010e99d0686115cf41b137f379ffbda1c49e3d
4
+ data.tar.gz: e373af792a659df672b302f533dde6b76cb175e7871757ac36368049a54a86e028bd40b8aa71a42b00c3163178a62569423cde1cdaa59f033cffe7e5f6a89b38
5
5
  SHA1:
6
- metadata.gz: 1cbe4e64d6f22abe8ec36482beab027d3f2055fe
7
- data.tar.gz: 965e1e649a25cc0e953dd9e4c7051c58bfad40b4
6
+ metadata.gz: 7d3fa23cf04c5898fc849e1bcb358af221afe5e7
7
+ data.tar.gz: a7821117711f09639ebc6ad821d2e015ef5f1301
@@ -1,6 +1,7 @@
1
1
  require "resque_stuck_queue/version"
2
2
  require "resque_stuck_queue/config"
3
3
  require "resque_stuck_queue/heartbeat_job"
4
+ require "resque_stuck_queue/signals"
4
5
 
5
6
  # TODO move this require into a configurable?
6
7
  require 'resque'
@@ -8,7 +9,6 @@ require 'resque'
8
9
  # TODO rm redis-mutex dep and just do the setnx locking here
9
10
  require 'redis-mutex'
10
11
 
11
-
12
12
  module Resque
13
13
  module StuckQueue
14
14
 
@@ -39,7 +39,7 @@ module Resque
39
39
 
40
40
  def triggered_key_for(queue)
41
41
  if config[:triggered_key]
42
- "#{queue}:#{self.configconfig[:triggered_key]}"
42
+ "#{queue}:#{self.config[:triggered_key]}"
43
43
  else
44
44
  "#{queue}:#{TRIGGERED_KEY}"
45
45
  end
@@ -68,6 +68,8 @@ module Resque
68
68
  config.validate_required_keys!
69
69
  config.freeze
70
70
 
71
+ Signals.enable!
72
+
71
73
  log_starting_info
72
74
 
73
75
  reset_keys
@@ -27,6 +27,7 @@ module Resque
27
27
  :queues => "optional, monitor specific queues you want to send a heartbeat/monitor to. default is :app",
28
28
  :abort_on_exception => "optional, if you want the resque-stuck-queue threads to explicitly raise, default is false",
29
29
  :heartbeat_job => "optional, your own custom refreshing job. if you are using something other than resque",
30
+ :enable_signals => "optional, allow resque::stuck's signal_handlers",
30
31
  }
31
32
 
32
33
  OPTIONS = OPTIONS_DESCRIPTIONS.keys
@@ -0,0 +1,23 @@
1
+ module Resque
2
+ module StuckQueue
3
+ module Signals
4
+ extend self
5
+
6
+ def enable!
7
+ if Resque::StuckQueue.config[:enable_signals]
8
+
9
+ trap("SIGUSR1") do
10
+ ENV['SIGUSR1'] = "done be had"
11
+ Resque::StuckQueue.logger.info("¯\_(ツ)_/¯ ...")
12
+ end
13
+
14
+ trap("SIGUSR2") do
15
+ require 'pry'
16
+ binding.pry
17
+ end
18
+
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,5 +1,5 @@
1
1
  module Resque
2
2
  module StuckQueue
3
- VERSION = "0.3.1"
3
+ VERSION = "0.3.2"
4
4
  end
5
5
  end
@@ -48,6 +48,19 @@ class TestConfig < Minitest::Test
48
48
  end
49
49
  end
50
50
 
51
+ def test_can_have_signals
52
+ puts "#{__method__}"
53
+ begin
54
+ assert_equal ENV['SIGUSR1'], nil
55
+ Resque::StuckQueue.config[:enable_signals] = true
56
+ start_and_stop_loops_after(1)
57
+ Process.kill "SIGUSR1", Process.pid
58
+ assert_equal ENV['SIGUSR1'], "done be had"
59
+ rescue => e
60
+ assert false, "should have succeeded with signal handlers: #{e.inspect}\n#{e.backtrace.join("\n")}"
61
+ end
62
+ end
63
+
51
64
  end
52
65
 
53
66
 
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.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shai Rosenfeld
@@ -68,6 +68,7 @@ files:
68
68
  - lib/resque_stuck_queue.rb
69
69
  - lib/resque_stuck_queue/config.rb
70
70
  - lib/resque_stuck_queue/heartbeat_job.rb
71
+ - lib/resque_stuck_queue/signals.rb
71
72
  - lib/resque_stuck_queue/version.rb
72
73
  - resque_stuck_queue.gemspec
73
74
  - test/resque/set_redis_key.rb