soscripted / sox

Stack Overflow Extras: a userscript for the Stack Exchange websites to add a bunch of optional toggle-able features
http://stackapps.com/q/6091/
MIT License
72 stars 15 forks source link

API use makes SOX too slow and results in backoffs #467

Closed double-beep closed 3 years ago

double-beep commented 4 years ago

As of now, 15 SOX features use the API. This makes SOX too slow and results in backoffs. While SOX has to use the API (some info can't be obtained from the site itself!) the features which use it too much should either be rewritten or the getFromAPI method should be removed.

I'm in the process of rewriting these features in order to make SOX faster and stop those annoying backoffs!

Any more ideas?

shu8 commented 4 years ago

I'm not sure GET requests is more efficient than using the API. Ideally we should make our usage of the API more efficient instead.

GET requests are subject to SE's website rate-limiting which is much more annoying than an API backoff, because if you get rate limited for accessing the website, you'll have to wait a few hours before being able to access it again.

It's also more resource-intensive for SE themselves for us to be doing GET requests to get this information rather than use the API which they've made purely to get the information we want.

Using the API also lets us cache the data more easily and in a more generic form so we can do it for all functions!


I think we should tackle the backoffs issue you're mentioning here rather than trying to do GET requests on the pages. How many backoffs do you get? How frequently? This is something that is definitely fixable!

double-beep commented 4 years ago

I've been using GETs for some time now: SOX is a lot faster and I've not been rate-limited!

I get backoffs when opening many tabs at once, when skipping too much in the review (sox-new-review-post-appeared is triggered).

shu8 commented 4 years ago

I'll have to look into this a bit more when I get some time, sorry for the extremely late reply!

double-beep commented 3 years ago

We should probably enhance the API requests rather than directly fetching the info from the site.