diff options
author | Eugen <eugen@zeonfederated.com> | 2017-04-05 18:48:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-05 18:48:41 +0200 |
commit | 1b8c244dff84ae981d89a1672a9db06f08cf405e (patch) | |
tree | 48df3e9d81e4c1a3d9102aea78ff6583ba88ea32 /app | |
parent | 3d8b80e1cc8206d3a2d9904eb216269f0e38e66a (diff) |
Add proper message to PushUpdateWorker, use redis directly
Diffstat (limited to 'app')
-rw-r--r-- | app/workers/push_update_worker.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/workers/push_update_worker.rb b/app/workers/push_update_worker.rb index fef75d909..9d16c20bf 100644 --- a/app/workers/push_update_worker.rb +++ b/app/workers/push_update_worker.rb @@ -5,7 +5,8 @@ class PushUpdateWorker def perform(timeline, account_id, status_id) account = Account.find(account_id) - status = Status.find(status_id) + status = Status.find(status_id) + message = Rabl::Renderer.new( 'api/v1/statuses/show', status, @@ -14,6 +15,8 @@ class PushUpdateWorker scope: InlineRablScope.new(account) ) - ActionCable.server.broadcast("timeline:#{account_id}", type: 'update', timeline: timeline, message: message.render) + Redis.current.publish("timeline:#{timeline_id}", Oj.dump({ event: :update, payload: message, queued_at: (Time.now.to_f * 1000.0).to_i })) + rescue ActiveRecord::RecordNotFound + true end end |