airbyte-source-github 1.8.33__py3-none-any.whl → 1.8.35.dev202507171002__py3-none-any.whl
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.
Potentially problematic release.
This version of airbyte-source-github might be problematic. Click here for more details.
- {airbyte_source_github-1.8.33.dist-info → airbyte_source_github-1.8.35.dev202507171002.dist-info}/METADATA +1 -1
- {airbyte_source_github-1.8.33.dist-info → airbyte_source_github-1.8.35.dev202507171002.dist-info}/RECORD +5 -5
- source_github/backoff_strategies.py +18 -6
- {airbyte_source_github-1.8.33.dist-info → airbyte_source_github-1.8.35.dev202507171002.dist-info}/WHEEL +0 -0
- {airbyte_source_github-1.8.33.dist-info → airbyte_source_github-1.8.35.dev202507171002.dist-info}/entry_points.txt +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
source_github/__init__.py,sha256=punPc3v0mXEYOun7cbkfM5KUhgjv72B9DgDhI4VtzcQ,1134
|
|
2
|
-
source_github/backoff_strategies.py,sha256=
|
|
2
|
+
source_github/backoff_strategies.py,sha256=rzzSxuf9FEGOb7aXqPgl4A4dIKggW3uPnESwloVX1bM,3164
|
|
3
3
|
source_github/config_migrations.py,sha256=H58hHqAnuvb0B8IXHW4aEDZ3HotEg7HdA2rXDG9XW7A,3832
|
|
4
4
|
source_github/constants.py,sha256=Hj3Q4y7OoU-Iff4m9gEC2CjwmWJYXhNbHVNjg8EBLmQ,238
|
|
5
5
|
source_github/errors_handlers.py,sha256=POqpvbrNAoZztjwByOJxJbIaxhWC8KWLi3gK1WzbiK8,7259
|
|
@@ -58,7 +58,7 @@ source_github/source.py,sha256=1o8eayigi4xSUeNHdCd-mhNswGUq_XQrVk2eihTjm1o,14246
|
|
|
58
58
|
source_github/spec.json,sha256=7LOQm01fP_RvPF-HifhNPJ7i0AxT2LTNPaLAA3uOfNY,7443
|
|
59
59
|
source_github/streams.py,sha256=h5YMPLIsLTv7WX_mcURVC2LmmWBLraZvKH8J_GzV1IE,77441
|
|
60
60
|
source_github/utils.py,sha256=Ztd8VWwzTNUg_A96_8R9XSKorIcBa8wJ6aYUqygRkyk,5492
|
|
61
|
-
airbyte_source_github-1.8.
|
|
62
|
-
airbyte_source_github-1.8.
|
|
63
|
-
airbyte_source_github-1.8.
|
|
64
|
-
airbyte_source_github-1.8.
|
|
61
|
+
airbyte_source_github-1.8.35.dev202507171002.dist-info/METADATA,sha256=CAKHjaasoVkCAFMszFj0iAOPjvJGsmzXz6JgCav5Lws,5218
|
|
62
|
+
airbyte_source_github-1.8.35.dev202507171002.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
63
|
+
airbyte_source_github-1.8.35.dev202507171002.dist-info/entry_points.txt,sha256=gYhqVrTAZvMwuYByg0b_-o115yUFLLcfNxMrLZmiW9k,55
|
|
64
|
+
airbyte_source_github-1.8.35.dev202507171002.dist-info/RECORD,,
|
|
@@ -9,9 +9,16 @@ import requests
|
|
|
9
9
|
|
|
10
10
|
from airbyte_cdk import BackoffStrategy
|
|
11
11
|
from airbyte_cdk.sources.streams.http import HttpStream
|
|
12
|
+
from airbyte_cdk.utils import AirbyteTracedException
|
|
13
|
+
from airbyte_protocol.models import FailureType
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
class GithubStreamABCBackoffStrategy(BackoffStrategy):
|
|
17
|
+
min_backoff_time = 60.0
|
|
18
|
+
min_backoff_time_when_refreshing_auth_token = 60.0 * 10 # 10 minutes as default and as default time for access token live period
|
|
19
|
+
# 3600 - max seconds between messages from metadata
|
|
20
|
+
max_seconds_between_messages = 3600.0
|
|
21
|
+
|
|
15
22
|
def __init__(self, stream: HttpStream, **kwargs): # type: ignore # noqa
|
|
16
23
|
self.stream = stream
|
|
17
24
|
super().__init__(**kwargs)
|
|
@@ -23,24 +30,29 @@ class GithubStreamABCBackoffStrategy(BackoffStrategy):
|
|
|
23
30
|
# `X-RateLimit-Reset` header which contains time when this hour will be finished and limits will be reset so
|
|
24
31
|
# we again could have 5000 per another hour.
|
|
25
32
|
if isinstance(response_or_exception, requests.Response):
|
|
26
|
-
min_backoff_time = 60.0
|
|
27
33
|
retry_after = response_or_exception.headers.get("Retry-After")
|
|
28
34
|
if retry_after is not None:
|
|
29
|
-
backoff_time_in_seconds = max(float(retry_after), min_backoff_time)
|
|
35
|
+
backoff_time_in_seconds = max(float(retry_after), self.min_backoff_time)
|
|
30
36
|
return self.get_waiting_time(backoff_time_in_seconds)
|
|
31
37
|
|
|
32
38
|
reset_time = response_or_exception.headers.get("X-RateLimit-Reset")
|
|
33
39
|
if reset_time:
|
|
34
|
-
backoff_time_in_seconds = max(float(reset_time) - time.time(), min_backoff_time)
|
|
40
|
+
backoff_time_in_seconds = max(float(reset_time) - time.time(), self.min_backoff_time)
|
|
35
41
|
return self.get_waiting_time(backoff_time_in_seconds)
|
|
36
42
|
return None
|
|
37
43
|
|
|
38
|
-
def get_waiting_time(self, backoff_time_in_seconds:
|
|
44
|
+
def get_waiting_time(self, backoff_time_in_seconds: float) -> Optional[float]:
|
|
39
45
|
if backoff_time_in_seconds < 60 * 10: # type: ignore[operator]
|
|
40
46
|
return backoff_time_in_seconds
|
|
47
|
+
elif backoff_time_in_seconds > self.max_seconds_between_messages:
|
|
48
|
+
raise AirbyteTracedException(
|
|
49
|
+
internal_message="Waiting time from header is too long.",
|
|
50
|
+
message=f"The stream {self.stream.name} have faced rate limits, but waiting time is too long. The stream will sync data in the next sync when rate limits are refreshed.",
|
|
51
|
+
failure_type=FailureType.transient_error,
|
|
52
|
+
)
|
|
41
53
|
else:
|
|
42
|
-
self.stream._http_client._session.auth.update_token() # New token will be used in next request
|
|
43
|
-
return
|
|
54
|
+
self.stream._http_client._session.auth.update_token() # New token will be used in the next request
|
|
55
|
+
return self.stream._http_client._session.auth.max_time or self.min_backoff_time_when_refreshing_auth_token
|
|
44
56
|
|
|
45
57
|
|
|
46
58
|
class ContributorActivityBackoffStrategy(BackoffStrategy):
|
|
File without changes
|
|
File without changes
|