logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe
commit: 1aad015bbbe7957827c2b921a21c53ce11c6ac36
parent: 94fba44eecf21f5554fc62112aa4b6daff396ff5
Author: abcang <abcang1015@gmail.com>
Date:   Thu, 14 Sep 2017 22:12:43 +0900

Revert unique retry job (#4937)

* Revert "Enable UniqueRetryJobMiddleware even when called from sidekiq worker (#4836)"

This reverts commit 6859d4c0289e767955aac3f345074220fe200604.

* Revert "Do not execute the job with the same arguments as the retry job (#4814)"

This reverts commit be7ffa2d7539d5a1946a3933cb9d242b9fac0ddc.

Diffstat:

Mapp/workers/pubsubhubbub/subscribe_worker.rb2+-
Mconfig/application.rb1-
Mconfig/initializers/sidekiq.rb6------
Dlib/mastodon/unique_retry_job_middleware.rb20--------------------
4 files changed, 1 insertion(+), 28 deletions(-)

diff --git a/app/workers/pubsubhubbub/subscribe_worker.rb b/app/workers/pubsubhubbub/subscribe_worker.rb @@ -3,7 +3,7 @@ class Pubsubhubbub::SubscribeWorker include Sidekiq::Worker - sidekiq_options queue: 'push', retry: 10, unique: :until_executed, dead: false, unique_retry: true + sidekiq_options queue: 'push', retry: 10, unique: :until_executed, dead: false sidekiq_retry_in do |count| case count diff --git a/config/application.rb b/config/application.rb @@ -10,7 +10,6 @@ require_relative '../app/lib/exceptions' require_relative '../lib/paperclip/gif_transcoder' require_relative '../lib/paperclip/video_transcoder' require_relative '../lib/mastodon/version' -require_relative '../lib/mastodon/unique_retry_job_middleware' Dotenv::Railtie.load diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb @@ -9,14 +9,8 @@ end Sidekiq.configure_server do |config| config.redis = redis_params - config.client_middleware do |chain| - chain.add Mastodon::UniqueRetryJobMiddleware - end end Sidekiq.configure_client do |config| config.redis = redis_params - config.client_middleware do |chain| - chain.add Mastodon::UniqueRetryJobMiddleware - end end diff --git a/lib/mastodon/unique_retry_job_middleware.rb b/lib/mastodon/unique_retry_job_middleware.rb @@ -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