{"action":"opened","issue":{"url":"https://api.github.com/repos/miguelgrinberg/python-socketio/issues/143","repository_url":"https://api.github.com/repos/miguelgrinberg/python-socketio","labels_url":"https://api.github.com/repos/miguelgrinberg/python-socketio/issues/143/labels{/name}","comments_url":"https://api.github.com/repos/miguelgrinberg/python-socketio/issues/143/comments","events_url":"https://api.github.com/repos/miguelgrinberg/python-socketio/issues/143/events","html_url":"https://github.com/miguelgrinberg/python-socketio/issues/143","id":271350849,"number":143,"title":"when my redis is crash.pub,sub will not reactivate","user":{"login":"larry-dev","id":18585750,"avatar_url":"https://avatars3.githubusercontent.com/u/18585750?v=4","gravatar_id":"","url":"https://api.github.com/users/larry-dev","html_url":"https://github.com/larry-dev","followers_url":"https://api.github.com/users/larry-dev/followers","following_url":"https://api.github.com/users/larry-dev/following{/other_user}","gists_url":"https://api.github.com/users/larry-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/larry-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larry-dev/subscriptions","organizations_url":"https://api.github.com/users/larry-dev/orgs","repos_url":"https://api.github.com/users/larry-dev/repos","events_url":"https://api.github.com/users/larry-dev/events{/privacy}","received_events_url":"https://api.github.com/users/larry-dev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-11-06T03:40:04Z","updated_at":"2017-11-06T03:40:04Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Hi @miguelgrinberg !\r\nwhen my redis is crash.pub,sub will not reactivate.\r\ni try repair in asyncio_redis_manage.py.\r\nThe following code：\r\n```\r\n    async def _publish(self, data):\r\n\r\n        if self.pub is None:\r\n            self.pub = await aioredis.create_redis((self.host, self.port),\r\n                                                   db=self.db,\r\n                                                   password=self.password)\r\n        try:\r\n            await self.pub.ping()\r\n        except:\r\n            self.pub = await aioredis.create_redis((self.host, self.port),\r\n                                                   db=self.db,\r\n                                                   password=self.password)\r\n        return await self.pub.publish(self.channel, pickle.dumps(data))\r\n\r\n    async def _listen(self):\r\n        if self.sub is None:\r\n            self.sub = await aioredis.create_redis((self.host, self.port),\r\n                                                   db=self.db,\r\n                                                   password=self.password)\r\n            self.ch = (await self.sub.subscribe(self.channel))[0]\r\n\r\n        while True:\r\n            try:\r\n                return await self.ch.get()\r\n            except:\r\n                value=True\r\n                while value:\r\n                    try:\r\n                        self.sub = await aioredis.create_redis((self.host, self.port),\r\n                                                               db=self.db,\r\n                                                               password=self.password)\r\n                        value=False\r\n                    except:\r\n                        pass\r\n                self.ch = (await self.sub.subscribe(self.channel))[0]\r\n                return await self.ch.get()\r\n```\r\n"}}
{"actor":{"display_login":"larry-dev"}}