diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-05-16 09:42:32 +0200 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2022-05-16 09:42:32 +0200 |
commit | 040b7d37a460e5f023f7654b1b619368cbbc24ea (patch) | |
tree | 251a14cd362a6d98c1721e8f3f54fc386165e464 /app/workers | |
parent | 94e98864e39c010635e839fea984f2b4893bef1a (diff) | |
parent | c3fac61f56b3ad63534961f3d3c426cdf8ac6213 (diff) |
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts: - `app/services/remove_status_service.rb`: Conflict due to glitch-soc having extra code for a proper direct visibility timeline, in a part of the code upstream refactored. Restored glitch-soc's extra code in the refactored bit.
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/distribution_worker.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/app/workers/distribution_worker.rb b/app/workers/distribution_worker.rb index 474b4daaf..59cdbc7b2 100644 --- a/app/workers/distribution_worker.rb +++ b/app/workers/distribution_worker.rb @@ -3,14 +3,11 @@ class DistributionWorker include Sidekiq::Worker include Redisable + include Lockable def perform(status_id, options = {}) - RedisLock.acquire(redis: redis, key: "distribute:#{status_id}", autorelease: 5.minutes.seconds) do |lock| - if lock.acquired? - FanOutOnWriteService.new.call(Status.find(status_id), **options.symbolize_keys) - else - raise Mastodon::RaceConditionError - end + with_lock("distribute:#{status_id}") do + FanOutOnWriteService.new.call(Status.find(status_id), **options.symbolize_keys) end rescue ActiveRecord::RecordNotFound true |