diff options
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/distribution_worker.rb | 3 | ||||
-rw-r--r-- | app/workers/merge_worker.rb | 3 | ||||
-rw-r--r-- | app/workers/scheduler/accounts_statuses_cleanup_scheduler.rb | 7 |
3 files changed, 8 insertions, 5 deletions
diff --git a/app/workers/distribution_worker.rb b/app/workers/distribution_worker.rb index 770325ccf..474b4daaf 100644 --- a/app/workers/distribution_worker.rb +++ b/app/workers/distribution_worker.rb @@ -2,9 +2,10 @@ class DistributionWorker include Sidekiq::Worker + include Redisable def perform(status_id, options = {}) - RedisLock.acquire(redis: Redis.current, key: "distribute:#{status_id}", autorelease: 5.minutes.seconds) do |lock| + 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 diff --git a/app/workers/merge_worker.rb b/app/workers/merge_worker.rb index 6ebb9a400..e526d2887 100644 --- a/app/workers/merge_worker.rb +++ b/app/workers/merge_worker.rb @@ -2,12 +2,13 @@ class MergeWorker include Sidekiq::Worker + include Redisable def perform(from_account_id, into_account_id) FeedManager.instance.merge_into_home(Account.find(from_account_id), Account.find(into_account_id)) rescue ActiveRecord::RecordNotFound true ensure - Redis.current.del("account:#{into_account_id}:regeneration") + redis.del("account:#{into_account_id}:regeneration") end end diff --git a/app/workers/scheduler/accounts_statuses_cleanup_scheduler.rb b/app/workers/scheduler/accounts_statuses_cleanup_scheduler.rb index 7195f0ff9..bd92fe32c 100644 --- a/app/workers/scheduler/accounts_statuses_cleanup_scheduler.rb +++ b/app/workers/scheduler/accounts_statuses_cleanup_scheduler.rb @@ -2,6 +2,7 @@ class Scheduler::AccountsStatusesCleanupScheduler include Sidekiq::Worker + include Redisable # This limit is mostly to be nice to the fediverse at large and not # generate too much traffic. @@ -83,14 +84,14 @@ class Scheduler::AccountsStatusesCleanupScheduler end def last_processed_id - Redis.current.get('account_statuses_cleanup_scheduler:last_account_id') + redis.get('account_statuses_cleanup_scheduler:last_account_id') end def save_last_processed_id(id) if id.nil? - Redis.current.del('account_statuses_cleanup_scheduler:last_account_id') + redis.del('account_statuses_cleanup_scheduler:last_account_id') else - Redis.current.set('account_statuses_cleanup_scheduler:last_account_id', id, ex: 1.hour.seconds) + redis.set('account_statuses_cleanup_scheduler:last_account_id', id, ex: 1.hour.seconds) end end end |