Skip to content

Commit 23cce40

Browse files
fix: Skip the dependencies stream with a warning if it has timed out and been retried (#554)
SSIA Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
1 parent 5f1d1c2 commit 23cce40

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

tap_github/repository_streams.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from dateutil.parser import parse
1010
from singer_sdk import typing as th # JSON Schema typing helpers
11-
from singer_sdk.exceptions import FatalAPIError
11+
from singer_sdk.exceptions import FatalAPIError, RetriableAPIError
1212
from singer_sdk.helpers.jsonpath import extract_jsonpath
1313

1414
from tap_github.client import GitHubDiffStream, GitHubGraphqlStream, GitHubRestStream
@@ -3343,6 +3343,19 @@ def http_headers(self) -> dict:
33433343
headers["Accept"] = "application/vnd.github.hawkgirl-preview+json"
33443344
return headers
33453345

3346+
def get_records(self, context: Context | None) -> Iterable[dict[str, Any]]:
3347+
try:
3348+
yield from super().get_records(context)
3349+
except RetriableAPIError as e:
3350+
if "timedout" in str(e):
3351+
self.logger.warning(
3352+
"Skipping dependencies for %s/%s due to GitHub API timeout.",
3353+
context and context.get("org"),
3354+
context and context.get("repo"),
3355+
)
3356+
else:
3357+
raise
3358+
33463359
def post_process(self, row: dict, context: Context | None = None) -> dict:
33473360
"""
33483361
Add a dependency_repo_id top-level field to be used as primary key.

0 commit comments

Comments
 (0)