DE-101 (Python Rewrite): Added retry functionality when fetching Avro schemas#33
DE-101 (Python Rewrite): Added retry functionality when fetching Avro schemas#33fatimarahman merged 6 commits intomainfrom
Conversation
|
|
||
| def __init__(self, platform_schema_url): | ||
| self.logger = create_log("avro_encoder") | ||
| retry_policy = Retry(total=2, backoff_factor=4, |
There was a problem hiding this comment.
Does total=2 mean it will try twice or it will retry twice for a total of three requests? We want the second one, but I think we actually want 4 total tries so we can take advantage of the backoff. I think backoff_factor should be like 90 so that it waits 0 seconds between try 1 and try 2, 90 between 2 and 3, and then 180 between 3 and 4. I've always been a little confused about how this works, though, so correct me if that's not how the requests will be timed!
There was a problem hiding this comment.
It will retry twice for a total of three requests! I'll make that update so we get four total tries. Based on my understanding, if we set the backoff_factor to 90, I think it'll be 180 between 2 and 3, etc (since {backoff factor} * (2 ** ({number of previous retries}))). I'll set the backoff_factor to 45 to better suit our purposes (thus we get 90 between 2 and 3, 180 between 3 and 4).
As per our offline discussion. This will be useful whenever the platform API is temporarily down. The retry functionality is inspired by location-hours-poller and patron-info-poller.