-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Major Change
Currently local threshold is set as an option for individual instances of read preference classes:
# PyMongo 3.0-dev, removed by this change. from pymongo.read_preferences import Secondary rp = Secondary(latency_threshold_ms=20000)
This ticket tracks making localThreshold global and immutable. That is, it can only be set through the URI option localThresholdMS, or passed to the constructor for MongoClient as a keyword argument:
client = pymongo.MongoClient('mongodb://localhost:27017/?localThresholdMS=20000') client = pymongo.MongoClient(localThresholdMS=20000)
It can not be reset after client creation and is not settable per Database, Collection, or operation. mongos does not support per operation changes to localThreshold through the $readPreference directive, so the existing driver API can lead to dramatic behavior changes when migrating from a standalone mongod or replica set to a sharded cluster.