sidekiq-ultimate 0.0.1.alpha.4 → 0.0.1.alpha.5
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
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f0176019d0fa6bd44ec34fb292e7caafdaa78ab4c8d5dc33c03f2f933b5db74
|
4
|
+
data.tar.gz: ab8225dae6c14e67784ef3147cad83e1d1597df234626837207d6fd8ba783997
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d222fcb849ad439eddb9957c6b4fc9c87010181e5b97dc217eaf512402902137671141f090ab3a431fba12d13c145e11d5c6bcd477c94319e267daebfcbfeb97
|
7
|
+
data.tar.gz: f5ec33ba4bbf1159ec79f12dc4c416f6a79b77f64c4f161bf85690f40173702c513e475884e84dc127a24bc6373b32dc8e84bd59e64dcab36cfd45e8b48ab946
|
@@ -51,6 +51,8 @@ module Sidekiq
|
|
51
51
|
def resurrect!
|
52
52
|
lock do
|
53
53
|
casualties.each do |identity|
|
54
|
+
Sidekiq.logger.debug { "[#{self}] Resurrecting #{identity}" }
|
55
|
+
|
54
56
|
queues = queues_of(identity).each { |queue| resurrect(queue) }
|
55
57
|
cleanup(identity, queues.map(&:inproc))
|
56
58
|
end
|
@@ -101,7 +103,15 @@ module Sidekiq
|
|
101
103
|
|
102
104
|
def resurrect(queue)
|
103
105
|
Sidekiq.redis do |redis|
|
104
|
-
RESURRECT.eval(redis,
|
106
|
+
count = RESURRECT.eval(redis, {
|
107
|
+
:keys => [queue.inproc, queue.pending]
|
108
|
+
})
|
109
|
+
|
110
|
+
if count.positive?
|
111
|
+
Sidekiq.logger.info do
|
112
|
+
"[#{self}] Resurrected #{count} jobs of #{queue.inspect}"
|
113
|
+
end
|
114
|
+
end
|
105
115
|
end
|
106
116
|
end
|
107
117
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "redis/prescription"
|
4
|
+
|
3
5
|
require "sidekiq/throttled"
|
4
6
|
|
5
7
|
module Sidekiq
|
@@ -8,6 +10,10 @@ module Sidekiq
|
|
8
10
|
#
|
9
11
|
# @private
|
10
12
|
class UnitOfWork
|
13
|
+
REQUEUE = Redis::Prescription.read \
|
14
|
+
"#{__dir__}/unit_of_work/requeue.lua"
|
15
|
+
private_constant :REQUEUE
|
16
|
+
|
11
17
|
# JSON payload
|
12
18
|
#
|
13
19
|
# @return [String]
|
@@ -49,7 +55,7 @@ module Sidekiq
|
|
49
55
|
#
|
50
56
|
# @return [void]
|
51
57
|
def requeue
|
52
|
-
|
58
|
+
__requeue__("RPUSH")
|
53
59
|
end
|
54
60
|
|
55
61
|
# Pushes job back to the head of the queue, so that job won't be tried
|
@@ -60,12 +66,7 @@ module Sidekiq
|
|
60
66
|
#
|
61
67
|
# @return [void]
|
62
68
|
def requeue_throttled
|
63
|
-
|
64
|
-
redis.pipelined do
|
65
|
-
redis.lpush(@queue.pending, @job)
|
66
|
-
acknowledge
|
67
|
-
end
|
68
|
-
end
|
69
|
+
__requeue__("LPUSH")
|
69
70
|
end
|
70
71
|
|
71
72
|
# Tells whenever job should be pushed back to queue (throttled) or not.
|
@@ -75,6 +76,17 @@ module Sidekiq
|
|
75
76
|
def throttled?
|
76
77
|
Sidekiq::Throttled.throttled?(@job)
|
77
78
|
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def __requeue__(command)
|
83
|
+
Sidekiq.redis do |redis|
|
84
|
+
REQUEUE.eval(redis, {
|
85
|
+
:keys => [@queue.pending, @queue.inproc],
|
86
|
+
:argv => [command, @job]
|
87
|
+
})
|
88
|
+
end
|
89
|
+
end
|
78
90
|
end
|
79
91
|
end
|
80
92
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-ultimate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.alpha.
|
4
|
+
version: 0.0.1.alpha.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Zapparov
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- lib/sidekiq/ultimate/resurrector/resurrect.lua
|
120
120
|
- lib/sidekiq/ultimate/resurrector/safeclean.lua
|
121
121
|
- lib/sidekiq/ultimate/unit_of_work.rb
|
122
|
+
- lib/sidekiq/ultimate/unit_of_work/requeue.lua
|
122
123
|
- lib/sidekiq/ultimate/version.rb
|
123
124
|
- sidekiq-ultimate.gemspec
|
124
125
|
homepage: https://github.com/sensortower/sidekiq-ultimate
|