pokerogue
pokerogue copied to clipboard
Exponential backoff in unavailable-modal-ui-handler
Currently when the servers are down each player attempts to reconnect every 5 seconds. I'm not sure how much of the DDoS-like traffic the game is getting is due to this retry, but it seems like it can't hurt to add some kind of exponential backoff. I'm not super comfortable as a typescript dev and I don't know how to get this dialogue to appear when running locally, so use caution.
PR Description: Current state of the game is calling updateUserInfo() every 5 seconds when the game is in unavailable state.
This change make the request delay exponential up to 1 minutes to drastically reduce the stress on the server from every game that are let opened.
Closing this due to inactivity. Feel free to make a new request if interest is reignited
I'd recommend setting the maximum at 5 minutes and add some randomness to avoid the pendulum effect where all requests end up being synchronized and make a BIG ddos at regular interval
The last commit ~~removes the randomness and~~ resets the delay to 1 minute instead of 5, that's not good I didn't say anything about random, but only 1 minute is still short for a global outage where many clients could be left open 😅
I've tested this with a local server, forcing the /info request to return a 500 error, and the delay is well included in the exponential backoff set up, so it looks all right to me apart from the shortened maximum delay.
This should save the server from getting a ton of useless requests during outages, making the situation worse in the event of a provider's ddos block.
Server view requests
![]()
Client view requests
Sorry about any confusion caused with how I had to go about this. Had to make a bunch of changes and test on someone else's repository and it just ended up being faster to create my own branch with the changes rather than keep editing this one. Closing this out for real this time.