Revert unique retry job (#4937)
* Revert "Enable UniqueRetryJobMiddleware even when called from sidekiq worker (#4836)" This reverts committh-downstream0080804f44
. * Revert "Do not execute the job with the same arguments as the retry job (#4814)" This reverts commit892aeb7ffe
.
parent
4d80e3c550
commit
579a7c2654
@ -1,20 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Mastodon::UniqueRetryJobMiddleware
|
||||
def call(_worker_class, item, _queue, _redis_pool)
|
||||
return if item['unique_retry'] && retried?(item)
|
||||
yield
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def retried?(item)
|
||||
# Use unique digest key of SidekiqUniqueJobs
|
||||
unique_key = SidekiqUniqueJobs::UNIQUE_DIGEST_KEY
|
||||
unique_digest = item[unique_key]
|
||||
class_name = item['class']
|
||||
retries = Sidekiq::RetrySet.new
|
||||
|
||||
retries.any? { |job| job.item['class'] == class_name && job.item[unique_key] == unique_digest }
|
||||
end
|
||||
end
|
Loading…
Reference in new issue