-
Type:
Task
-
Resolution: Done
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Python Drivers
-
None
-
None
-
None
-
None
-
None
-
None
In pymongo/asynchronous/client_session.py, the _TxnState, _EmptyServerSession, _ServerSession, _ServerSessionPool classes are all identical between async and sync. They can be lifted to a shared file unchanged.
SessionOptions and TransactionOptions can also be consolidated into shared classes, with minor complications caused by docstring references to async/sync classes. These can either be generalized to be IO-agnostic or resolved with stub subclasses to keep the current split references.
The top-level module methods _make_timeout_error, _max_time_expired_error, _reraise_with_unknown_commit, _within_time_limit, _WITH_TRANSACTION_RETRY_TIME_LIMIT, _BACKOFF_MAX, _BACKOFF_INITIAL, _validate_session_write_concern can also be consolidated.