Class: Workers::DeferredDispatch

Inherits:
Base
  • Object
show all
Defined in:
app/workers/deferred_dispatch.rb

Instance Method Summary collapse

Instance Method Details

#perform(user_id, object_class_name, object_id, opts) ⇒ Object


11
12
13
14
15
16
17
18
# File 'app/workers/deferred_dispatch.rb', line 11

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

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