quandl / quandl-python

MIT License
1.37k stars 336 forks source link

Cp 7117/add retries to api calls #124

Closed jjmar closed 5 years ago

jjmar commented 5 years ago

Overview

Automatically retry API calls if they return with any status codes within RETRY_STATUS_CODES. Allows user to configure all retry settings via ApiConfig. Enables retry functionality to True by default.

A note on the default settings with regards to sleep time

~I've set the defaults of max_wait_between_retries to 15 seconds, number_of_retries to 8 and retry_backoff_factor to 0.1. These settings will provide the user max 8 retries, with wait times of [0.1, 0.2, 0.4, 0.8, 1.6. 3.2, 6.4, 12.8, 15] for each retry.~

~Cumulatively this would be 40 seconds wait time assuming each of there calls error out. With any settings higher than this I suppose we run the risk of having the user wondering what is going on with their call. What does everyone think of these defaults?~

After discussing with Eric we agreed the current defaults were a bit to aggressive. I've reduced number_of_retries to 5, retry_backoff_factor to 0.5 and max_wait_between_retries to 8 seconds.

fengshuo commented 5 years ago

I think for the default values, it's better to check with the person who created the ticket before merging it to prod 😅