Exemplo n.º 1
0
 def _publish_to_subscribers(self, feed, story_hash):
     try:
         r = redis.Redis(connection_pool=settings.REDIS_PUBSUB_POOL)
         listeners_count = r.publish("%s:story" % feed.pk, 'story:new:%s' % story_hash)
         if listeners_count:
             logging.debug("   ---> [%-30s] ~FMPublished to %s subscribers" % (feed.log_title[:30], listeners_count))
     except redis.ConnectionError:
         logging.debug("   ***> [%-30s] ~BMRedis is unavailable for real-time." % (feed.log_title[:30],))
     
     if MUserFeedNotification.feed_has_users(feed.pk) > 0:
         QueueNotifications.delay(feed.pk, 1)