postburner 1.0.0.pre.21 → 1.0.0.pre.22
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: 7751ed8ba40ce899b9bf180cff95e8b72f0862d3dabafba282ea3a34e1a116c1
|
|
4
|
+
data.tar.gz: 584283e10f18bca0010f5cb5936c3cfb957fc8105a5f92ddbbf11415a527a476
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 45ee3b0c0246b2a5a565941e1d2cf00532e5ce957a5ff5dd27da541774bc36e14cbab2676de6a3e9dd78752a3c32e0a3095439134f7596748265bdd6776cce0c
|
|
7
|
+
data.tar.gz: caba9af9897d1e0cc4ac267b18637f88c4631302b6b7905715ea363842ef6ae03d5d4e754944ccdab9550f5f795e4a08d262e88ed302f4650c7c02e045d45b1f
|
|
@@ -48,7 +48,7 @@ module Postburner
|
|
|
48
48
|
# @see Queue.handle_perform!
|
|
49
49
|
# @see NullQueue.handle_perform!
|
|
50
50
|
#
|
|
51
|
-
def perform(id,
|
|
51
|
+
def perform(id, beanstalk_job: nil)
|
|
52
52
|
job = nil
|
|
53
53
|
begin
|
|
54
54
|
job = self.find(id)
|
|
@@ -57,7 +57,7 @@ module Postburner
|
|
|
57
57
|
[Postburner::Job] [#{id}] Not Found.
|
|
58
58
|
MSG
|
|
59
59
|
end
|
|
60
|
-
|
|
60
|
+
job.bk = beanstalk_job if job && beanstalk_job
|
|
61
61
|
Postburner.queue_strategy.handle_perform!(job)
|
|
62
62
|
end
|
|
63
63
|
end
|
|
@@ -174,12 +174,26 @@ module Postburner
|
|
|
174
174
|
# @see #kick!
|
|
175
175
|
#
|
|
176
176
|
def bk
|
|
177
|
-
return unless self.bkid.present?
|
|
178
177
|
return @__job if @__job
|
|
178
|
+
return unless self.bkid.present?
|
|
179
179
|
|
|
180
180
|
@__job = Postburner.connection.beanstalk.jobs.find(self.bkid)
|
|
181
181
|
end
|
|
182
182
|
|
|
183
|
+
# Sets the Beanstalkd job object directly.
|
|
184
|
+
#
|
|
185
|
+
# Used by the worker to pass the reserved Beanstalkd job to the model,
|
|
186
|
+
# ensuring that operations like {#extend!}, {#delete!}, and {#kick!}
|
|
187
|
+
# use the actual reserved job rather than a fresh lookup via peek.
|
|
188
|
+
#
|
|
189
|
+
# @param job [Beaneater::Job] Reserved Beanstalkd job object
|
|
190
|
+
#
|
|
191
|
+
# @see #bk
|
|
192
|
+
#
|
|
193
|
+
def bk=(job)
|
|
194
|
+
@__job = job
|
|
195
|
+
end
|
|
196
|
+
|
|
183
197
|
# Returns the Beanstalkd job object with cache invalidation.
|
|
184
198
|
#
|
|
185
199
|
# Same as {#bk} but clears the cached instance variable first,
|
|
@@ -21,13 +21,13 @@ module Postburner
|
|
|
21
21
|
#
|
|
22
22
|
# @raise [StandardError] if job execution fails
|
|
23
23
|
#
|
|
24
|
-
def execute(payload_json)
|
|
24
|
+
def execute(payload_json, beanstalk_job: nil)
|
|
25
25
|
payload = Payload.parse(payload_json)
|
|
26
26
|
|
|
27
27
|
if Payload.legacy_format?(payload)
|
|
28
|
-
execute_legacy(payload)
|
|
28
|
+
execute_legacy(payload, beanstalk_job: beanstalk_job)
|
|
29
29
|
elsif Payload.tracked?(payload)
|
|
30
|
-
execute_tracked(payload)
|
|
30
|
+
execute_tracked(payload, beanstalk_job: beanstalk_job)
|
|
31
31
|
else
|
|
32
32
|
execute_default(payload)
|
|
33
33
|
end
|
|
@@ -44,7 +44,7 @@ module Postburner
|
|
|
44
44
|
#
|
|
45
45
|
# @return [void]
|
|
46
46
|
#
|
|
47
|
-
def execute_tracked(payload)
|
|
47
|
+
def execute_tracked(payload, beanstalk_job: nil)
|
|
48
48
|
job_id = payload['postburner_job_id']
|
|
49
49
|
|
|
50
50
|
unless job_id
|
|
@@ -52,7 +52,7 @@ module Postburner
|
|
|
52
52
|
end
|
|
53
53
|
|
|
54
54
|
# Delegate to Postburner::Job.perform which handles the full lifecycle
|
|
55
|
-
Postburner::Job.perform(job_id)
|
|
55
|
+
Postburner::Job.perform(job_id, beanstalk_job: beanstalk_job)
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
# Executes a default job (Beanstalkd only, no PostgreSQL).
|
|
@@ -96,12 +96,12 @@ module Postburner
|
|
|
96
96
|
#
|
|
97
97
|
# @return [void]
|
|
98
98
|
#
|
|
99
|
-
def execute_legacy(payload)
|
|
99
|
+
def execute_legacy(payload, beanstalk_job: nil)
|
|
100
100
|
job_class = payload['class'].constantize
|
|
101
101
|
job_id = payload['args'].first
|
|
102
102
|
|
|
103
103
|
# Delegate to the class's perform method (Postburner::Job.perform)
|
|
104
|
-
job_class.perform(job_id)
|
|
104
|
+
job_class.perform(job_id, beanstalk_job: beanstalk_job)
|
|
105
105
|
end
|
|
106
106
|
end
|
|
107
107
|
end
|
data/lib/postburner/version.rb
CHANGED
data/lib/postburner/worker.rb
CHANGED
|
@@ -628,7 +628,7 @@ module Postburner
|
|
|
628
628
|
|
|
629
629
|
ActiveSupport::Notifications.instrument('perform.job.postburner', instrument_payload) do
|
|
630
630
|
Rails.application.reloader.wrap do
|
|
631
|
-
Postburner::ActiveJob::Execution.execute(beanstalk_job.body)
|
|
631
|
+
Postburner::ActiveJob::Execution.execute(beanstalk_job.body, beanstalk_job: beanstalk_job)
|
|
632
632
|
end
|
|
633
633
|
end
|
|
634
634
|
|