起因 同事想要写一个代码,主进程中监听SIGINT.SIGTERM信号退出,并关闭启动的子进程,代码类似这样 import signal import sys import time from multiprocessing import Process from multiprocessing import Manager class Test: def __init__(self): self.is_running = True if sys.platform != 'win32': sig
答:Disconnecting will close all underlying sockets in the connection pool. If this instance is used again it will be automatically re-opened. 转自:http://stackoverflow.com/questions/18401015/how-to-close-a-mongodb-python-connection http://stackoverflow.