Skip to content

Commit 0ac98a9

Browse files
committed
[sc-98468] Fix throttling calculation
1 parent 93f9a1e commit 0ac98a9

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
## [Version 1.0.7](https://github.com/dataiku/dss-plugin-api-connect/releases/tag/v1.0.7) - Bugfix release - 2022-08-30
55

66
- Handling Offset pagination on APIs returning an array
7+
- Fix throttling calculation
78

89
## [Version 1.0.6](https://github.com/dataiku/dss-plugin-api-connect/releases/tag/v1.0.6) - Feature and bugfix release - 2022-05-19
910

python-lib/rest_api_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,9 @@ def request(self, method, url, can_raise_exeption=True, **kwargs):
119119
kwargs = template_dict(kwargs, **self.presets_variables)
120120
if self.loop_detector.is_stuck_in_loop(url, kwargs.get("params", {}), kwargs.get("headers", {})):
121121
raise RestAPIClientError("The api-connect plugin is stuck in a loop. Please check the pagination parameters.")
122+
request_start_time = time.time()
123+
self.time_last_request = request_start_time
122124
try:
123-
request_start_time = time.time()
124125
response = self.request_with_redirect_retry(method, url, **kwargs)
125126
request_finish_time = time.time()
126127
except Exception as err:
@@ -131,7 +132,6 @@ def request(self, method, url, can_raise_exeption=True, **kwargs):
131132
else:
132133
return {"error": error_message}
133134
self.set_metadata("request_duration", request_finish_time - request_start_time)
134-
self.time_last_request = time.time()
135135
self.set_metadata("status_code", response.status_code)
136136
self.set_metadata("response_headers", "{}".format(response.headers))
137137
if response.status_code >= 400:

0 commit comments

Comments
 (0)