mirror of
https://git.bsd.gay/fef/nyastodon.git
synced 2024-12-24 18:13:42 +01:00
Add proper message to PushUpdateWorker, use redis directly
This commit is contained in:
parent
3d8b80e1cc
commit
1b8c244dff
1 changed files with 5 additions and 2 deletions
|
@ -5,7 +5,8 @@ class PushUpdateWorker
|
||||||
|
|
||||||
def perform(timeline, account_id, status_id)
|
def perform(timeline, account_id, status_id)
|
||||||
account = Account.find(account_id)
|
account = Account.find(account_id)
|
||||||
status = Status.find(status_id)
|
status = Status.find(status_id)
|
||||||
|
|
||||||
message = Rabl::Renderer.new(
|
message = Rabl::Renderer.new(
|
||||||
'api/v1/statuses/show',
|
'api/v1/statuses/show',
|
||||||
status,
|
status,
|
||||||
|
@ -14,6 +15,8 @@ class PushUpdateWorker
|
||||||
scope: InlineRablScope.new(account)
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue