The code powering m.abunchtell.com https://m.abunchtell.com
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 

20 řádky
643 B

  1. # frozen_string_literal: true
  2. class PublishScheduledAnnouncementWorker
  3. include Sidekiq::Worker
  4. include Redisable
  5. def perform(announcement_id)
  6. announcement = Announcement.find(announcement_id)
  7. announcement.update(published: true, published_at: Time.now.utc, scheduled_at: nil) unless announcement.published?
  8. payload = InlineRenderer.render(announcement, nil, :announcement)
  9. payload = Oj.dump(event: :announcement, payload: payload)
  10. FeedManager.instance.with_active_accounts do |account|
  11. redis.publish("timeline:#{account.id}", payload) if redis.exists("subscribed:timeline:#{account.id}")
  12. end
  13. end
  14. end