Fix jobs being added to batch after they might already execute (#35496)

This commit is contained in:
Eugen Rochko 2025-07-28 10:20:12 +02:00 committed by GitHub
parent a57a9505d4
commit 018e5e303f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 52 additions and 12 deletions

View 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