SH + CP review

This commit is contained in:
Noah Stapp 2026-03-13 10:21:59 -04:00
parent 37243035ac
commit a7fc68f3ee
4 changed files with 4 additions and 10 deletions

View File

@ -569,7 +569,6 @@ class _AsyncClientBulk:
and "errorLabels" in error.details
and isinstance(error.details["errorLabels"], list)
and "RetryableError" in error.details["errorLabels"]
and "SystemOverloadedError" in error.details["errorLabels"]
)
# Synthesize the full bulk result without modifying the

View File

@ -567,7 +567,6 @@ class _ClientBulk:
and "errorLabels" in error.details
and isinstance(error.details["errorLabels"], list)
and "RetryableError" in error.details["errorLabels"]
and "SystemOverloadedError" in error.details["errorLabels"]
)
# Synthesize the full bulk result without modifying the

View File

@ -96,20 +96,18 @@ class TestBackpressure(AsyncIntegrationTest):
@async_client_context.require_failCommand_appName
async def test_retry_overload_error_insert_one(self):
await self.db.t.insert_one({"x": 1})
# Ensure command is retried on overload error.
fail_many = mock_overload_error.copy()
fail_many["mode"] = {"times": _MAX_RETRIES}
async with self.fail_point(fail_many):
await self.db.t.find_one()
await self.db.t.insert_one({"x": 1})
# Ensure command stops retrying after _MAX_RETRIES.
fail_too_many = mock_overload_error.copy()
fail_too_many["mode"] = {"times": _MAX_RETRIES + 1}
async with self.fail_point(fail_too_many):
with self.assertRaises(PyMongoError) as error:
await self.db.t.find_one()
await self.db.t.insert_one({"x": 1})
self.assertIn("RetryableError", str(error.exception))
self.assertIn("SystemOverloadedError", str(error.exception))

View File

@ -96,20 +96,18 @@ class TestBackpressure(IntegrationTest):
@client_context.require_failCommand_appName
def test_retry_overload_error_insert_one(self):
self.db.t.insert_one({"x": 1})
# Ensure command is retried on overload error.
fail_many = mock_overload_error.copy()
fail_many["mode"] = {"times": _MAX_RETRIES}
with self.fail_point(fail_many):
self.db.t.find_one()
self.db.t.insert_one({"x": 1})
# Ensure command stops retrying after _MAX_RETRIES.
fail_too_many = mock_overload_error.copy()
fail_too_many["mode"] = {"times": _MAX_RETRIES + 1}
with self.fail_point(fail_too_many):
with self.assertRaises(PyMongoError) as error:
self.db.t.find_one()
self.db.t.insert_one({"x": 1})
self.assertIn("RetryableError", str(error.exception))
self.assertIn("SystemOverloadedError", str(error.exception))