Skip to content

Commit 631c2e8

Browse files
committed
address review
1 parent 0f040ea commit 631c2e8

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

pymongo/asynchronous/pool.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
DocumentTooLarge,
5353
ExecutionTimeout,
5454
InvalidOperation,
55+
NetworkTimeout,
5556
NotPrimaryError,
5657
OperationFailure,
5758
PyMongoError,
@@ -1025,7 +1026,7 @@ async def remove_stale_sockets(self, reference_generation: int) -> None:
10251026
def _handle_connection_error(self, error: BaseException) -> None:
10261027
# Handle system overload condition for non-sdam pools.
10271028
# Look for errors of type AutoReconnect and add error labels if appropriate.
1028-
if self.is_sdam or type(error) != AutoReconnect:
1029+
if self.is_sdam or type(error) not in (AutoReconnect, NetworkTimeout):
10291030
return
10301031
error._add_error_label("SystemOverloadedError")
10311032
error._add_error_label("RetryableError")

pymongo/synchronous/pool.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
DocumentTooLarge,
5050
ExecutionTimeout,
5151
InvalidOperation,
52+
NetworkTimeout,
5253
NotPrimaryError,
5354
OperationFailure,
5455
PyMongoError,
@@ -1021,7 +1022,7 @@ def remove_stale_sockets(self, reference_generation: int) -> None:
10211022
def _handle_connection_error(self, error: BaseException) -> None:
10221023
# Handle system overload condition for non-sdam pools.
10231024
# Look for errors of type AutoReconnect and add error labels if appropriate.
1024-
if self.is_sdam or type(error) != AutoReconnect:
1025+
if self.is_sdam or type(error) not in (AutoReconnect, NetworkTimeout):
10251026
return
10261027
error._add_error_label("SystemOverloadedError")
10271028
error._add_error_label("RetryableError")

test/asynchronous/test_pooling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ async def test_connection_timeout_message(self):
517517
@async_client_context.require_failCommand_appName
518518
async def test_pool_backpressure_preserves_existing_connections(self):
519519
client = await self.async_rs_or_single_client()
520-
coll = self.db.t
520+
coll = client.pymongo_test.t
521521
pool = await async_get_pool(client)
522522
await coll.insert_many([{"x": 1} for _ in range(10)])
523523
t = SocketGetter(self.c, pool)

test/test_pooling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ def test_connection_timeout_message(self):
515515
@client_context.require_failCommand_appName
516516
def test_pool_backpressure_preserves_existing_connections(self):
517517
client = self.rs_or_single_client()
518-
coll = self.db.t
518+
coll = client.pymongo_test.t
519519
pool = get_pool(client)
520520
coll.insert_many([{"x": 1} for _ in range(10)])
521521
t = SocketGetter(self.c, pool)

0 commit comments

Comments
 (0)