Welcome to mirror list, hosted at ThFree Co, Russian Federation.

deferred_dispatch.rb « workers « app - github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c60ab11d1a5b5a73fd6770b46c775bde4e0a3fd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

#   Copyright (c) 2010-2011, Diaspora Inc.  This file is
#   licensed under the Affero General Public License version 3 or later.  See
#   the COPYRIGHT file.

module Workers
  class DeferredDispatch < Base
    sidekiq_options queue: :high

    def perform(user_id, object_class_name, object_id, opts)
      user = User.find(user_id)
      object = object_class_name.constantize.find(object_id)

      Diaspora::Federation::Dispatcher.build(user, object, opts.deep_symbolize_keys).dispatch
    rescue ActiveRecord::RecordNotFound # The target got deleted before the job was run
    end
  end
end