bugdantic 0.4.2__tar.gz → 0.4.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bugdantic-0.4.2 → bugdantic-0.4.3}/PKG-INFO +1 -1
- {bugdantic-0.4.2 → bugdantic-0.4.3}/bugdantic/bugzilla.py +20 -6
- {bugdantic-0.4.2 → bugdantic-0.4.3}/bugdantic.egg-info/PKG-INFO +1 -1
- {bugdantic-0.4.2 → bugdantic-0.4.3}/pyproject.toml +1 -1
- {bugdantic-0.4.2 → bugdantic-0.4.3}/LICENSE +0 -0
- {bugdantic-0.4.2 → bugdantic-0.4.3}/README.md +0 -0
- {bugdantic-0.4.2 → bugdantic-0.4.3}/bugdantic/__init__.py +0 -0
- {bugdantic-0.4.2 → bugdantic-0.4.3}/bugdantic/py.typed +0 -0
- {bugdantic-0.4.2 → bugdantic-0.4.3}/bugdantic/userstory.py +0 -0
- {bugdantic-0.4.2 → bugdantic-0.4.3}/bugdantic.egg-info/SOURCES.txt +0 -0
- {bugdantic-0.4.2 → bugdantic-0.4.3}/bugdantic.egg-info/dependency_links.txt +0 -0
- {bugdantic-0.4.2 → bugdantic-0.4.3}/bugdantic.egg-info/requires.txt +0 -0
- {bugdantic-0.4.2 → bugdantic-0.4.3}/bugdantic.egg-info/top_level.txt +0 -0
- {bugdantic-0.4.2 → bugdantic-0.4.3}/setup.cfg +0 -0
- {bugdantic-0.4.2 → bugdantic-0.4.3}/test/test_bugzilla.py +0 -0
- {bugdantic-0.4.2 → bugdantic-0.4.3}/test/test_userstory.py +0 -0
|
@@ -2,8 +2,9 @@ import base64
|
|
|
2
2
|
import enum
|
|
3
3
|
import json
|
|
4
4
|
import logging
|
|
5
|
+
import time
|
|
5
6
|
from collections.abc import Mapping, MutableMapping, Sequence
|
|
6
|
-
from dataclasses import dataclass
|
|
7
|
+
from dataclasses import dataclass, field
|
|
7
8
|
from datetime import datetime
|
|
8
9
|
from typing import (
|
|
9
10
|
Any,
|
|
@@ -436,6 +437,7 @@ class BugzillaConfig:
|
|
|
436
437
|
allow_writes: bool = False
|
|
437
438
|
# Number of times to retry a request if there's a 503 error
|
|
438
439
|
max_retries: int = 1
|
|
440
|
+
retry_status_codes: set[int] = field(default_factory=lambda: {502, 503})
|
|
439
441
|
|
|
440
442
|
|
|
441
443
|
BugType = TypeVar("BugType", bound=BaseModel)
|
|
@@ -496,18 +498,30 @@ class Bugzilla:
|
|
|
496
498
|
path = path.removeprefix("/")
|
|
497
499
|
|
|
498
500
|
url = urljoin(self.config.base_url, f"/rest/{path}")
|
|
499
|
-
|
|
501
|
+
logging.debug("Fetching from bugzilla: %s", url)
|
|
500
502
|
if self.config.allow_writes or method in {"GET", "OPTIONS", "HEAD"}:
|
|
501
503
|
retry = 0
|
|
502
504
|
if self.config.max_retries < 0:
|
|
503
505
|
raise ValueError("max_retries must be at least 0")
|
|
504
506
|
response = None
|
|
505
507
|
while retry <= self.config.max_retries:
|
|
508
|
+
if retry != 0:
|
|
509
|
+
wait_time = 2**retry
|
|
510
|
+
logging.debug(
|
|
511
|
+
"Request failed, retrying %s/%s, sleeping %ss",
|
|
512
|
+
retry,
|
|
513
|
+
self.config.max_retries,
|
|
514
|
+
wait_time,
|
|
515
|
+
)
|
|
516
|
+
time.sleep(wait_time)
|
|
506
517
|
retry += 1
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
518
|
+
try:
|
|
519
|
+
response = self.client.request(
|
|
520
|
+
method, url, params=params, headers=headers, json=json_body
|
|
521
|
+
)
|
|
522
|
+
except httpx.ReadTimeout:
|
|
523
|
+
continue
|
|
524
|
+
if response.status_code not in self.config.retry_status_codes:
|
|
511
525
|
break
|
|
512
526
|
assert response is not None
|
|
513
527
|
try:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|