PrismarineJS / prismarine-realms

Library for interacting with Minecraft Realms
MIT License
11 stars 9 forks source link

Retry 5xx Errors #37

Closed LucienHH closed 1 year ago

LucienHH commented 1 year ago

This PR exponentially increases the retry delay and removes the retryCount parameter. The exponential increase in retry delay is intended to help mitigate intermittent errors that can occur when using the Realms API.

The first retry will have a delay of 1 second (2^0 1000). The second retry will have a delay of 2 seconds (2^1 1000). The third retry will have a delay of 4 seconds (2^2 1000). The fourth retry will have a delay of 8 seconds (2^3 1000). The fifth and final retry will have a delay of 16 seconds (2^4 * 1000).

extremeheat commented 1 year ago

More than 30 seconds is too long. Should be closer to 10-20 seconds max per request to not make actual errors take an long time to surface.

LucienHH commented 1 year ago

Lets just do 4 tries then. From testing it seems that the 4th retry is enough and responds ok.

LucienHH commented 1 year ago

Can we merge this for a release @extremeheat ?

extremeheat commented 1 year ago

Thanks