tvalentyn commented on code in PR #40598:
URL: https://github.com/apache/beam/pull/40598#discussion_r4285564772
##########
sdks/python/apache_beam/io/components/adaptive_throttler.py:
##########
@@ -173,14 +185,16 @@ def __init__(
window_ms=window_ms, bucket_ms=bucket_ms,
overload_ratio=overload_ratio)
def throttle(self):
- """ Stops request code from advancing while the underlying
- AdaptiveThrottler is signaling to preemptively throttle the request.
- Automatically handles logging the throttling and signaling to the SDK
- harness that the request is being throttled. This should be called in any
- context where a call to a remote service is being contacted prior to the
- call being performed.
+ """ Delays the request by throttle_delay_secs if the underlying
+ AdaptiveThrottler elects to preemptively throttle it, based on the failure
+ rate of recent requests. Automatically handles logging the throttling and
+ signaling to the SDK harness that the request is being throttled.
+
+ This should be called once for each attempt to contact a remote
+ service (including retries), prior to the call being performed. Each call
+ is recorded as one request attempt, and delays the request at most once.
"""
- while self.throttle_request(time.time() * _SECONDS_TO_MILLISECONDS):
+ if self.throttle_request(time.time() * _SECONDS_TO_MILLISECONDS):
Review Comment:
I don't follow why delaying the request each time counts as a separate
request - doesn't it artificially inflate the volume of the requests?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]