Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions test/asynchronous/test_client_backpressure.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,16 @@ async def test_05_overload_errors_with_basebackoffms_override_backoff(self, rand
# A run can never be faster than the sum of its backoffs.
# With jitter pinned to 1, the default backoffs are 0.2 + 0.4 = 0.6s
# and the baseBackoffMS=50 backoffs are 0.1 + 0.2 = 0.3s.
self.assertGreaterEqual(exponential_backoff_time, 0.6)
self.assertGreaterEqual(with_base_backoff_ms_time, 0.3)

# Allow for slight timing slack on Windows + <= Python 3.12 due to asyncio timing resolution
if sys.platform == "win32" and not _IS_SYNC and sys.version_info <= (3, 12):
exponential_expected = 0.55
base_backoff_expected = 0.25
else:
exponential_expected = 0.6
base_backoff_expected = 0.3
self.assertGreaterEqual(exponential_backoff_time, exponential_expected)
self.assertGreaterEqual(with_base_backoff_ms_time, base_backoff_expected)
self.assertLess(with_base_backoff_ms_time, 0.6)


Expand Down
12 changes: 10 additions & 2 deletions test/test_client_backpressure.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,16 @@ def test_05_overload_errors_with_basebackoffms_override_backoff(self, random_fun
# A run can never be faster than the sum of its backoffs.
# With jitter pinned to 1, the default backoffs are 0.2 + 0.4 = 0.6s
# and the baseBackoffMS=50 backoffs are 0.1 + 0.2 = 0.3s.
self.assertGreaterEqual(exponential_backoff_time, 0.6)
self.assertGreaterEqual(with_base_backoff_ms_time, 0.3)

# Allow for slight timing slack on Windows + <= Python 3.12 due to asyncio timing resolution
if sys.platform == "win32" and not _IS_SYNC and sys.version_info <= (3, 12):
exponential_expected = 0.55
base_backoff_expected = 0.25
else:
exponential_expected = 0.6
base_backoff_expected = 0.3
self.assertGreaterEqual(exponential_backoff_time, exponential_expected)
self.assertGreaterEqual(with_base_backoff_ms_time, base_backoff_expected)
self.assertLess(with_base_backoff_ms_time, 0.6)


Expand Down
Loading