topology.py 文件源码

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

项目:mongodb-monitoring 作者: jruaux 项目源码 文件源码
def open(self):
        """Start monitoring, or restart after a fork.

        No effect if called multiple times.

        .. warning:: To avoid a deadlock during Python's getaddrinfo call,
          will generate a warning if open() is called from a different
          process than the one that initialized the Topology. To prevent this
          from happening, MongoClient must be created after any forking OR
          MongoClient must be started with connect=False.
        """
        with self._lock:
            if self._pid is None:
                self._pid = os.getpid()
            else:
                if os.getpid() != self._pid:
                    warnings.warn(
                        "MongoClient opened before fork. Create MongoClient "
                        "with connect=False, or create client after forking. "
                        "See PyMongo's documentation for details: http://api."
                        "mongodb.org/python/current/faq.html#using-pymongo-"
                        "with-multiprocessing>")

            self._ensure_opened()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号