sidekiq_monitor 0.0.2 → 0.0.3

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.
@@ -1,6 +1,17 @@
1
1
  module Sidekiq
2
2
  module Monitor
3
3
  class Cleaner
4
+ @ignored_queues = []
5
+
6
+ class << self
7
+ attr_reader :ignored_queues
8
+
9
+ def add_ignored_queue(queue)
10
+ @ignored_queues << queue.to_s
11
+ @ignored_queues.uniq!
12
+ end
13
+ end
14
+
4
15
  # Cleans up records that are no longer in sync with Sidekiq's records
5
16
  def clean
6
17
  clean_queued
@@ -22,7 +33,7 @@ module Sidekiq
22
33
  end
23
34
 
24
35
  Sidekiq::Monitor::Job.where(status: 'queued').each do |job|
25
- unless queued_jids.include?(job.jid)
36
+ if !queued_jids.include?(job.jid) && !is_ignored_queue?(job.queue)
26
37
  job.update_attributes(
27
38
  finished_at: DateTime.now,
28
39
  status: 'interrupted'
@@ -44,7 +55,7 @@ module Sidekiq
44
55
  end
45
56
 
46
57
  Sidekiq::Monitor::Job.where(status: 'running').each do |job|
47
- unless busy_jids.include?(job.jid)
58
+ if !busy_jids.include?(job.jid) && !is_ignored_queue?(job.queue)
48
59
  job.update_attributes(
49
60
  finished_at: DateTime.now,
50
61
  status: 'interrupted'
@@ -53,6 +64,10 @@ module Sidekiq
53
64
  end
54
65
  end
55
66
  end
67
+
68
+ def is_ignored_queue?(queue)
69
+ self.class.ignored_queues.include?(queue)
70
+ end
56
71
  end
57
72
  end
58
73
  end
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  module Monitor
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq_monitor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-05 00:00:00.000000000 Z
12
+ date: 2013-06-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sidekiq