Note
Instances of MongoReplicaSetClient
start a background task to monitor the state of the replica set. This allows it to quickly respond to changes in replica set configuration. Before discarding an instance of MongoReplicaSetClient
make sure you call close()
to ensure that the monitor task is cleanly shut down.
PyMongo implements a PeriodicExecutor
for two purposes: as the background thread for Monitor
, and to regularly check if there are OP_KILL_CURSORS
messages that must be sent to the server.
http://api.mongodb.org/python/current/developer/periodic_executor.html