uhd-urz / elAPI

An extensible API client for eLabFTW
GNU Affero General Public License v3.0
5 stars 0 forks source link

Resolve "elAPI times out" - [merged] #72

Closed alexander-haller closed 4 months ago

alexander-haller commented 11 months ago

In GitLab by @mhxion on Dec 7, 2023, 01:48

Merges fix-timeout-in-prod -> dev

Closes #7

This fix increases the timeout for HTTP session to 3 minutes.

alexander-haller commented 11 months ago

In GitLab by @mhxion on Dec 7, 2023, 01:48

requested review from @alexander-haller

alexander-haller commented 11 months ago

approved this merge request

alexander-haller commented 9 months ago

In GitLab by @mhxion on Jan 31, 2024, 19:33

Update: This change also leads to a change in delay for the first retry attempt to trigger from 60 seconds to 180 seconds (3 minutes). This makes sense of course. To elaborate (see also the example on !11):

> elapi bill-teams generate-invoice --export ~ <- first run (retry count = 0)

<some network related error occurs>

> HTTP client will wait 180 seconds (3 minutes) before it times out
> When it does, it will throw InterruptedError
> This is our 1st network error, and retry is triggered at this moment

1st network error <- 1st retry is triggered (retry count = 1)
> Retry will wait 60 seconds before running bill-teams again.
> In total, we wait for 180 + 60 seconds or 4 minutes before running bill-teams (for the 2nd attempt).

> 2nd attempt of bill-teams start.

<some network related error occurs>

2nd network error <- 2nd retry is triggered (retry count = 2)
> Retry will wait 2 x 60s = 120 second before running bill-teams again.

> 3rd attempt of bill-teams start.

<some network related error occurs>

3rd network error <- 3rd retry is triggered (retry count = 3)
> Retry will wait 2 x 2 x 60s = 240 second before running bill-teams again.
# It will go on like this until retry count reaches 5.