class MessageUpdatesHandler(BaseHandler):
@tornado.web.authenticated
@tornado.web.asynchronous
def post(self):
self.listing_id = self.get_argument("listing_id", None)
self.cursor = self.get_argument("cursor", None)
self.client = brukva.Client()
self.client.connect()
self.client.subscribe(self.listing_id)
self.client.listen(self.on_new_messages)
def on_new_messages(self, messages):
# Closed client connection
if self.request.connection.stream.closed():
return
msg = json.loads(messages.body,'ascii')
self.finish(dict(messages=[msg]))
self.client.unsubscribe(self.listing_id)
def on_connection_close(self):
# unsubscribe user from channel
self.client.unsubscribe(self.listing_id)
self.client.disconnect()On 13 дек, 04:50, Burak DEDE <burakded...@gmail.com> wrote:
> I am building Tornado application and using redis pub/sub with brukva async
> client provided here. (https://github.com/evilkost/brukva)
>
> During the long polling operation I am using the below code and say when
> two client start to talk and post message each other I checked the redis
> server activity and total number of clients connected is increasing on top
> of each other. So is this default behaviour or what kind of connection
> strategy should I use seems like this connection creation in every post
> update is wrong ?
Maybe brukva doesn't close the socket properly? Just a guess.
--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To post to this group, send email to redi...@googlegroups.com.
To unsubscribe from this group, send email to redis-db+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/redis-db?hl=en.