0
0
Fork 0

Replace calls to FeedManager#inline_render and #broadcast

This commit is contained in:
Eugen Rochko 2017-04-05 19:45:18 +02:00
parent d755ce96da
commit 5b95be1c42
6 changed files with 26 additions and 20 deletions

View file

@ -3,19 +3,12 @@
class PushUpdateWorker
include Sidekiq::Worker
def perform(timeline, account_id, status_id)
def perform(account_id, status_id)
account = Account.find(account_id)
status = Status.find(status_id)
message = Rabl::Renderer.new(
'api/v1/statuses/show',
status,
view_path: 'app/views',
format: :json,
scope: InlineRablScope.new(account)
)
message = InlineRenderer.render(status, account, 'api/v1/statuses/show')
Redis.current.publish("timeline:#{account.id}", Oj.dump({ event: :update, payload: message, queued_at: (Time.now.to_f * 1000.0).to_i }))
Redis.current.publish("timeline:#{account.id}", Oj.dump(event: :update, payload: message, queued_at: (Time.now.to_f * 1000.0).to_i))
rescue ActiveRecord::RecordNotFound
true
end