Skip to content

Commit 54635cb

Browse files
docs: Tables for better compreension of retry strategies
1 parent e0b12bb commit 54635cb

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

README.md

+28-9
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,14 @@ client = ClientBuilder(endpoint="https://api.example.com"
5858
,connection_timeout=2
5959
,headers=headers)
6060

61-
"""
62-
NOTE: by default the quantity of retries is 3 and the time between retries is 1 second, but you can define manually.
63-
"""
64-
61+
# if you can define timeout with EXPONENTIAL_RETRY_STRATEGY and set headers:
6562
client = ClientBuilder(endpoint="https://api.example.com"
66-
,retry_strategy=RetryStrategies.LINEAR_RETRY_STRATEGY
63+
,retry_strategy=RetryStrategies.EXPONENTIAL_RETRY_STRATEGY
6764
,connection_timeout=10
6865
,headers=headers
6966
,retries=5
7067
,initial_delay=10)
71-
72-
73-
### timeout, retry_strategy and headers are opcionals parameters
68+
7469

7570
# Get data from the API
7671
data = client.get_api_data()
@@ -80,4 +75,28 @@ df = client.api_to_dataframe(data)
8075

8176
# Display the DataFrame
8277
print(df)
83-
```
78+
```
79+
80+
## Important notes:
81+
* **Opcionals Parameters:** The params timeout, retry_strategy and headers are opcionals.
82+
* **Default Params Value:** By default the quantity of retries is 3 and the time between retries is 1 second, but you can define manually.
83+
* **Max Of Retries:** For security of API Server there is a limit for quantity of retries, actually this value is 5, this value is defined in lib constant. You can inform any value in RETRIES param, but the lib only will try 5x.
84+
* **Exponential Retry Strategy:** The increment of time between retries is time passed in **initial_delay** param * 2 * the retry_number, e.g with initial_delay=1
85+
86+
RetryNumber | WaitingTime
87+
------------ | -----------
88+
1 | 1s
89+
2 | 2s
90+
3 | 4s
91+
4 | 6s
92+
5 | 8s
93+
* **Linear Retry Strategy:** The increment of time between retries is time passed in **initial_delay**
94+
e.g with initial_delay=1
95+
96+
RetryNumber | WaitingTime
97+
------------ | -----------
98+
1 | 1s
99+
2 | 1s
100+
3 | 1s
101+
4 | 1s
102+
5 | 1s

0 commit comments

Comments
 (0)