resque-durable 4.0.0 → 4.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.
- checksums.yaml +4 -4
- data/lib/resque/durable/background_heartbeat.rb +15 -7
- data/lib/resque/durable/queue_audit.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 494eb6a3c9e764eb8399ab674687afee948298b85d06c2c7944815762dc0bf9d
|
4
|
+
data.tar.gz: 7be3da9c71fa28a34f2c02d4f56e931b8ca4b3b9c5fd9048682ffa9a3c5ccfcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8ae872c2984e06a425167756ec665704b6134a84f854caeb0e069dfe5fa8593370b4fead874901cad9a84c2efeb07675134b01e8006164161dd50614f8018ed
|
7
|
+
data.tar.gz: 599622efbb0b65267558adc279b8431f640fd1fc50f0db3fcc23547ff1b852ebdf28bfd0b4f12744b3a038e81ff9cd6a56cf492025ba8bfb247d72473dc129cb
|
@@ -11,6 +11,7 @@ module Resque
|
|
11
11
|
@last_timeout = nil
|
12
12
|
@interval = interval
|
13
13
|
@mutex = Mutex.new
|
14
|
+
@cv = ConditionVariable.new
|
14
15
|
@stop = false
|
15
16
|
@thread = nil
|
16
17
|
end
|
@@ -51,7 +52,11 @@ module Resque
|
|
51
52
|
heartbeat!
|
52
53
|
|
53
54
|
@mutex.synchronize do
|
54
|
-
@
|
55
|
+
end_at = monotonic_now + @interval
|
56
|
+
while !@stop && monotonic_now < end_at
|
57
|
+
sleep_for = end_at - monotonic_now
|
58
|
+
@cv.wait(@mutex, sleep_for)
|
59
|
+
end
|
55
60
|
end
|
56
61
|
end
|
57
62
|
end
|
@@ -59,12 +64,9 @@ module Resque
|
|
59
64
|
|
60
65
|
def stop_and_wait!
|
61
66
|
return unless @thread
|
67
|
+
signal_stop!
|
62
68
|
# Prevent deadlock if called by the `heartbeat` thread, which can't wait for itself to die.
|
63
|
-
return
|
64
|
-
while @thread.alive?
|
65
|
-
signal_stop!
|
66
|
-
sleep 0.01
|
67
|
-
end
|
69
|
+
return if @thread == Thread.current
|
68
70
|
@thread.join
|
69
71
|
@thread = nil
|
70
72
|
end
|
@@ -74,9 +76,15 @@ module Resque
|
|
74
76
|
return unless @thread
|
75
77
|
@mutex.synchronize do
|
76
78
|
@stop = true
|
77
|
-
@
|
79
|
+
@cv.broadcast
|
78
80
|
end
|
79
81
|
end
|
82
|
+
|
83
|
+
private
|
84
|
+
|
85
|
+
def monotonic_now
|
86
|
+
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
87
|
+
end
|
80
88
|
end
|
81
89
|
end
|
82
90
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: resque-durable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Chapweske
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2023-02-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|