connection.py 文件源码

python
阅读 37 收藏 0 点赞 0 评论 0

项目:gimel 作者: Alephbet 项目源码 文件源码
def connect(self):
        "Connects to the Redis server if not already connected"
        if self._sock:
            return
        try:
            sock = self._connect()
        except socket.error:
            e = sys.exc_info()[1]
            raise ConnectionError(self._error_message(e))

        self._sock = sock
        try:
            self.on_connect()
        except RedisError:
            # clean up after any error in on_connect
            self.disconnect()
            raise

        # run any user callbacks. right now the only internal callback
        # is for pubsub channel/pattern resubscription
        for callback in self._connect_callbacks:
            callback(self)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号