From ef04f3879ac3bd7ec6dddd6cb843c8cdb79a1175 Mon Sep 17 00:00:00 2001 From: multiple creatures Date: Wed, 7 Aug 2019 01:08:07 -0500 Subject: add option to automatically space out boosts over configurable random intervals --- app/workers/reblog_status_worker.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 app/workers/reblog_status_worker.rb (limited to 'app/workers/reblog_status_worker.rb') diff --git a/app/workers/reblog_status_worker.rb b/app/workers/reblog_status_worker.rb new file mode 100644 index 000000000..c0b2153b2 --- /dev/null +++ b/app/workers/reblog_status_worker.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class ReblogStatusWorker + include Sidekiq::Worker + + sidekiq_options unique: :until_executed + + def perform(account_id, status_id, reblog_params = {}) + account = Account.find(account_id) + status = Status.find(status_id) + return false if status.destroyed? + ReblogService.new.call(account, status, reblog_params.symbolize_keys) + true + rescue ActiveRecord::RecordNotFound, ActiveRecord::RecordInvalid + true + end +end -- cgit