Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Handle Retry-After headers better for 429 responses #3464

Merged
merged 2 commits into from
Oct 14, 2024

Conversation

ptoscano
Copy link
Contributor

@ptoscano ptoscano commented Oct 9, 2024

  • Card ID: CCT-759

We have to ensure we normalize the headers before we search for the Retry-After header.

* Card ID: CCT-759

We have to ensure we normalize the headers before we search for the
Retry-After header.
@cnsnyder cnsnyder requested review from a team and cnsnyder and removed request for a team October 9, 2024 09:43
Copy link

github-actions bot commented Oct 9, 2024

Coverage

Coverage (computed on Fedora latest) •
FileStmtsMissCoverMissing
rhsm
   connection.py102747154%48–49, 53, 55–56, 81, 95, 106, 147, 281, 312, 378–383, 387–396, 457, 459, 565, 568, 575–581, 586, 642, 677–681, 683, 696, 723, 726–727, 729–730, 732, 743–747, 751, 755, 757–758, 777, 780, 784–785, 790, 793–794, 809, 813, 815–816, 843–844, 846, 849, 854–855, 858–859, 861, 863–867, 869–870, 873–880, 882–892, 894, 896–897, 908–910, 912–914, 916–918, 920–922, 924, 927–933, 935–936, 938–939, 941, 952–954, 956–957, 959–961, 963, 975–978, 983, 1047, 1049–1054, 1056, 1061–1065, 1071–1074, 1076–1081, 1085–1090, 1097, 1134, 1136, 1141, 1152, 1161–1164, 1168, 1170–1172, 1176–1177, 1179–1186, 1188, 1190, 1193–1200, 1203–1207, 1210–1215, 1222, 1224, 1276, 1293–1296, 1320, 1342, 1372, 1377, 1380, 1383–1384, 1389, 1392, 1397, 1400, 1443–1447, 1454–1455, 1457, 1466–1467, 1469, 1486, 1499–1501, 1504, 1515, 1520, 1525, 1553–1555, 1560–1561, 1563–1564, 1566–1567, 1569–1583, 1585–1587, 1589–1600, 1602, 1619–1621, 1623–1625, 1627–1629, 1634, 1639–1641, 1646, 1673, 1704–1730, 1735–1736, 1738–1740, 1743–1744, 1747–1748, 1751–1752, 1771–1772, 1781–1782, 1792–1793, 1800–1801, 1807–1810, 1816–1819, 1825–1826, 1832–1833, 1853–1854, 1870–1876, 1878, 1886–1887, 1913–1916, 1941–1942, 1951–1952, 1960–1961, 1982, 1984–1986, 1988, 1990, 1993, 1995–2008, 2010–2011, 2020–2022, 2034–2035, 2044–2045, 2047, 2049–2051, 2058–2060, 2069–2071, 2079–2080, 2091, 2093–2094, 2096, 2098–2101, 2103–2105, 2108, 2110, 2117–2118, 2125–2126, 2136–2137, 2147–2150, 2160–2166, 2173–2176
subscription_manager/scripts
   rhsmcertd_worker.py19412436%42–45, 87, 92–95, 100–101, 106–109, 149, 169–171, 173–175, 179, 188, 190, 194–196, 200, 203–206, 209, 212–213, 219–221, 223–227, 229–230, 240, 242, 244–245, 262, 265–266, 269, 272, 274–275, 278–280, 283, 287–292, 296–298, 302–305, 308, 312–314, 316, 322, 324, 326–329, 331–333, 335–336, 340, 342, 344, 346, 348–350, 352, 354–355, 357–361, 367–368, 372, 374, 378, 380–382, 392–395, 400–405, 409
TOTAL17676456474% 

Tests Skipped Failures Errors Time
2471 14 💤 0 ❌ 0 🔥 32.441s ⏱️

Copy link
Contributor

@jirihnidek jirihnidek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -500,10 +500,14 @@ class RateLimitExceededException(RestlibException):
The retry_after attribute may not be included in the response.
"""

def __init__(self, code: int, msg: str = None, headers: str = None) -> None:
def __init__(self, code: int, msg: str = None, headers: dict = None) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type hint of headers was just wrong, right? I can see that this exception is raised in validateResult() and it seems that the headers is dict there.

@jirihnidek jirihnidek merged commit b568393 into main Oct 14, 2024
17 checks passed
@jirihnidek jirihnidek deleted the ptoscano/retry-after branch October 14, 2024 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants