Skip to content

Commit

Permalink
馃帀 Source Recharge: improve 'backoff' for HTTP requests (#7626)
Browse files Browse the repository at this point in the history
* backoff for successful but incomplete responses

Signed-off-by: Sergey Chvalyuk <grubberr@gmail.com>
  • Loading branch information
grubberr committed Nov 8, 2021
1 parent 154ecce commit af903f2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"sourceDefinitionId": "45d2e135-2ede-49e1-939f-3e3ec357a65e",
"name": "Recharge",
"dockerRepository": "airbyte/source-recharge",
"dockerImageTag": "0.1.3",
"dockerImageTag": "0.1.4",
"documentationUrl": "https://docs.airbyte.io/integrations/sources/recharge"
}
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@
- name: Recharge
sourceDefinitionId: 45d2e135-2ede-49e1-939f-3e3ec357a65e
dockerRepository: airbyte/source-recharge
dockerImageTag: 0.1.3
dockerImageTag: 0.1.4
documentationUrl: https://docs.airbyte.io/integrations/sources/recharge
sourceType: api
- name: Recurly
Expand Down
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-recharge/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ RUN pip install .
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.1.3
LABEL io.airbyte.version=0.1.4
LABEL io.airbyte.name=airbyte/source-recharge
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ def get_stream_data(self, response_data: Any) -> List[dict]:
else:
return [response_data]

def should_retry(self, response: requests.Response) -> bool:
res = super().should_retry(response)
if res:
return res

# For some reason, successful responses contains incomplete data
content_length = int(response.headers.get("Content-Length", 0))
return response.status_code == 200 and content_length > len(response.content)


class IncrementalRechargeStream(RechargeStream, ABC):

Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/recharge.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Please read [How to generate your API token](https://support.rechargepayments.co

| Version | Date | Pull Request | Subject |
| :--- | :--- | :--- | :--- |
| 0.1.4 | 2021-11-05 | [7626](https://github.com/airbytehq/airbyte/pull/7626) | Improve 'backoff' for HTTP requests |
| 0.1.3 | 2021-09-17 | [6149](https://github.com/airbytehq/airbyte/pull/6149) | Update `discount` and `order` schema |
| 0.1.2 | 2021-09-17 | [6149](https://github.com/airbytehq/airbyte/pull/6149) | Change `cursor_field` for Incremental streams |
| | | | |
Expand Down

0 comments on commit af903f2

Please sign in to comment.