mirror of
https://github.com/yingziwu/mastodon.git
synced 2026-02-04 03:25:14 +00:00
Fix jobs being added to batch after they might already execute (#35496)
This commit is contained in:
parent
a57a9505d4
commit
018e5e303f
4 changed files with 52 additions and 12 deletions
11
lib/mastodon/worker_batch_middleware.rb
Normal file
11
lib/mastodon/worker_batch_middleware.rb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Mastodon::WorkerBatchMiddleware
|
||||
def call(_worker, msg, _queue, _redis_pool = nil)
|
||||
if (batch = Thread.current[:batch])
|
||||
batch.add_jobs([msg['jid']])
|
||||
end
|
||||
|
||||
yield
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue