testpushpleaseignore / acquisition

GNU General Public License v3.0
25 stars 5 forks source link

5 requests per every 70 seconds, instead of 45 requests every 60 #33

Open came-here-to-learn opened 1 year ago

came-here-to-learn commented 1 year ago

Since GGG introduce aggressive throttling, as a temp solution maybe this can be limited to 5 tabs checked every 70 seconds.

Better would be a dialog window to change both the number of tabs checked AND the time between each check

testpushpleaseignore commented 1 year ago

Just out of curiosity, before I merge this PR, did you happen to find any information about the number of http requests that third parties can make per time frame? I am going to do some testing to see if GGG is sending any 429 responses, and if so, hopefully it shows that limit that we can make these requests.

came-here-to-learn commented 1 year ago

First of all thank you very much!

The only information I have found is that they are using "dynamic throttling" now.

It seems acquisition gives three types of errors:

{"code":3,"message":"Rate limit exceeded; You are requesting your character list too frequently. Please try again later."}

Sometimes, you also get errors that it cannot even load character list (the server is busy?) or "Malformed tabs data: The error was The document is empty. "

I think I also had a bug where the character page gave a 404.

I came up with a very conservative number of 5 tabs every 70 seconds, just to be sure that it will be future proof - we are experiencing a big degradation of service on GGG's side. So better be safe than sorry. Perhaps other option is some config window or file, where user can input those.

This is probably not the correct place to do that, but is it possible to make some sort of a Github Action to automatically build the project, without having to download Visual Studio? I tried doing something like that but failed.

came-here-to-learn commented 1 year ago

Ah they have added a policy:

https://www.pathofexile.com/developer/docs#ratelimits

came-here-to-learn commented 1 year ago

It seems I got temp banned, with the error message:

Couldn't fetch character list: "https://www.pathofexile.com/character-window/get-characters" due to error: "Error transferring https://www.pathofexile.com/character-window/get-characters - server replied: Too Many Requests" Aborting update.

So you are correct - the app probably needs to work even slower, as per their policy. https://www.pathofexile.com/developer/docs#ratelimits

Or, as a stop-gap just please consider making it check just 1 tab per minute (in user adjusted window), because it is still better than nothing. I have 500 tabs...

testpushpleaseignore commented 1 year ago

So it looks like they are setting limits for each type of request being made. Here are the limits that I've run into so far:

"backend-character-request-limit"

X-Rate-Limit-Policy: "backend-character-request-limit"
X-Rate-Limit-Rules "Account,Ip"
X-Rate-Limit-Account "10:60:60,50:1800:600"
X-Rate-Limit-Account-State "11:60:60,12:1800:0"
X-Rate-Limit-Ip "30:60:120,120:1800:600"
X-Rate-Limit-Ip-State "12:60:0,12:1800:0"

"backend-item-request-limit"

X-Rate-Limit-Policy: "backend-item-request-limit"
X-Rate-Limit-Rules "Account,Ip"
X-Rate-Limit-Account "30:60:60,100:1800:600"
X-Rate-Limit-Account-State "31:60:60,85:1800:0"
X-Rate-Limit-Ip "45:60:120,180:1800:600"
X-Rate-Limit-Ip-State "31:60:0,85:1800:0"

So for characters, we can make 10 requests every 60 seconds, and 50 every 1800 seconds. And for item tabs, we can make 30 requests every 60 seconds, and 100 every 1800 seconds.

The original people who wrote this code just assumed that there was one global request limit, that never lasted for more than 60 seconds. So yeah worst case scenario, having 1 request per minute should prevent us from ever hitting any throttling, but I'd imagine that a number of people would get upset if I don't have this program operate as fast as possible without hitting the true limits. Might take a while to figure out how to queue these requests up to have their own limits, but I currently wouldn't have much time right now to figure this out.

Since they have implemented this dynamic throttling, I'm wondering if I can ask their servers for the current limits, so that every time a batch of transactions are about to be sent it out, it can check to see what the current limits are?

Otherwise as for your other question, I can't say that I've tried to use GitHub to automatically build this application, but yeah I would imagine that it would be quite difficult to have it build it for us.