sidekiq-postpone 0.3.0 → 0.3.1

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
  SHA256:
3
- metadata.gz: 634e909de058d8e5c067a0007f7e83c20e764552677104e53fa80add81e9ad54
4
- data.tar.gz: 8b906c5ce4efc944e6e388736310fb6c71ff304f72a19ac388367c43cb67b9fc
3
+ metadata.gz: 397128457629c5407f0a9eeae069ad7345d91dc08d8233aabd2003a0c7669131
4
+ data.tar.gz: 220589b707e7d63b1a94c8221bce1242aa56471743963080f9703647c73f663b
5
5
  SHA512:
6
- metadata.gz: bff94b3c27b98308a5bbe2d8771d626583ddb66f10a8df9524262931c3993a278d264539032a969b15f58b1c7314a9cf1e5d554a517e4cef8944a397e0b8ef82
7
- data.tar.gz: 8e05448529a78055810c04d5d2bc750138114a0081a3634d46d255ad89b24abba56dc763c7ef583393d788e3701532d8045114a533b09b632b88f84efc16d307
6
+ metadata.gz: 6d861f1d3d91792a1252877ae235854382f4c0321387d516ecba7bb31cd75c93b45cd7340c07df4c17145a35d56890b1115af6d8781fc9b8d1e03f0e50e67388
7
+ data.tar.gz: 181b4c712f1c0d3d93be653c75c1032a72b59fe9b6fe2fe237a6d748a53e45346a94ef995d4a1541986cc7a281effd230b817180f1a8cd1bc632ac5cadbb096d
@@ -11,8 +11,8 @@ class Sidekiq::Postpone
11
11
  setup_schedule
12
12
  end
13
13
 
14
- def wrap(join_parent: true, flush: true, **options)
15
- enter!(**options)
14
+ def wrap(join_parent: true, flush: true)
15
+ enter!
16
16
  begin
17
17
  yield self
18
18
  rescue
@@ -34,18 +34,12 @@ class Sidekiq::Postpone
34
34
  end
35
35
 
36
36
  def push(payloads)
37
- if @ignore
38
- payloads, ignored = payloads.partition(&@ignore)
39
- ignored = nil if ignored.empty?
40
- return ignored if payloads.empty?
41
- end
42
37
  if payloads.first['at']
43
38
  @schedule.concat(payloads)
44
39
  else
45
40
  q = payloads.first['queue']
46
41
  @queues[q].concat(payloads)
47
42
  end
48
- ignored
49
43
  end
50
44
 
51
45
  def clear!
@@ -84,8 +78,12 @@ class Sidekiq::Postpone
84
78
  @queues.empty? && @schedule.empty?
85
79
  end
86
80
 
81
+ def all_jobs
82
+ [*@queues.values.flatten(1), *@schedule]
83
+ end
84
+
87
85
  def jids
88
- [*@queues.values.flatten(1), *@schedule].map! { |j| j['jid'] }
86
+ all_jobs.map! { |j| j['jid'] }
89
87
  end
90
88
 
91
89
  protected
@@ -94,13 +92,12 @@ class Sidekiq::Postpone
94
92
 
95
93
  private
96
94
 
97
- def enter!(ignore: nil)
95
+ def enter!
98
96
  if @entered
99
97
  raise 'Sidekiq::Postpone#wrap is not re-enterable on the same instance'
100
98
  else
101
99
  @entered = true
102
100
  end
103
- @ignore = ignore
104
101
  Thread.current[:sidekiq_postpone_stack] ||= []
105
102
  Thread.current[:sidekiq_postpone_stack].push(self)
106
103
  Thread.current[:sidekiq_postpone] = self
@@ -111,7 +108,6 @@ class Sidekiq::Postpone
111
108
  head = Thread.current[:sidekiq_postpone_stack].last
112
109
  Thread.current[:sidekiq_postpone] = head
113
110
  @entered = false
114
- @ignore = nil
115
111
  if @flush_on_leave
116
112
  @flush_on_leave = false
117
113
  flush!
@@ -3,9 +3,7 @@ class Sidekiq::Postpone
3
3
  def raw_push(payloads)
4
4
  postpone = Thread.current[:sidekiq_postpone]
5
5
  if postpone
6
- ignored = postpone.push(payloads)
7
- super(ignored) if ignored
8
- true
6
+ postpone.push(payloads)
9
7
  else
10
8
  super
11
9
  end
@@ -1,5 +1,5 @@
1
1
  module Sidekiq
2
2
  class Postpone
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-postpone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Kochnev