Ejemplo n.º 1
0
 def add_message(self, message_data):
     data = json.dumps(message_data, cls=CJsonEncoder)
     rds.zadd(self.db_key, data, to_timestamp(message_data.get('date')))
     rds.zremrangebyrank(self.db_key, 0,  -1 * (MAX_MESSAGE_COUNT + 1))
     rds_pub_signal.send('add_message',
                         data=data,
                         channel=self.db_key)
Ejemplo n.º 2
0
Archivo: feed.py Proyecto: zhmch/code
 def add_action(self, action_data):
     data = json.dumps(action_data, cls=CJsonEncoder)
     # the order of args to zadd is reversed in redis-py from that in redis
     print rds, data, self.db_key, action_data
     rds.zadd(self.db_key, data, to_timestamp(action_data.get("date")))
     rds.zremrangebyrank(self.db_key, 0, -1 * (MAX_ACTIONS_COUNT + 1))
     rds_pub_signal.send("feed_add_action", data=data, channel=self.db_key, is_notify=False, show_avatar=True)
Ejemplo n.º 3
0
 def add_action(self, action_data):
     data = json.dumps(action_data, cls=CJsonEncoder)
     # the order of args to zadd is reversed in redis-py from that in redis
     print rds, data, self.db_key, action_data
     rds.zadd(self.db_key, data, to_timestamp(action_data.get('date')))
     rds.zremrangebyrank(self.db_key, 0, -1 * (MAX_ACTIONS_COUNT + 1))
     rds_pub_signal.send('feed_add_action',
                         data=data,
                         channel=self.db_key,
                         is_notify=False,
                         show_avatar=True)