Greasy Fork is available in English.

Greasyfork 快捷编辑收藏

在GF脚本页直接编辑收藏集

< 脚本Greasyfork 快捷编辑收藏的反馈

提问/评论

JasonBarnabe管理员
§
发表于:2024-06-12

This script causes users to get 503 errors due to excessive requests to the script set edit page. I've seen it in the logs causing upwards of 50 requests per second.

Can this be adjusted to.... not do that? Is there an alternative API that I could implement that you could use instead?

§
发表于:2024-06-24
编辑于:2024-06-24

You could add an endpoint for each user to show a .json list of all sets and each link/id for each script in the set, or if that is too hard and time consuming to do another option that wouldn't require you to do anything would be for this script dev to fetch all sets once, an store the script id/link for all scripts in the set, then if that set/link is opened again, there is no need to fetch the set again, as he could simply use the data that is already stored, then if a user removes a script from a set while in the script or the set page, he just has to track that change, this would make the script only make "1" fetch request after the user installed the script.

PYUDNG作者
§
发表于:2024-06-30

I've tried to resolve it, but failed. In one hand, there is no API for managing greasyfork's script sets, only requesting webpage and simulating form submission of script set page has the ability to view and modify script sets data. In another hand, users can and may edit script set content in a context without this userscript running (for example, in another browser or device that has this userscript not installed), so tracking the modification of script set is not possible (or at least not possible for accurate tracking). Due to these issues, I made this script automatically sync script sets and their contents each time the userscript is loaded, which resulted in a large number of requests.

It indeed caused some users to get 503 error, and I've tried to figure out some way to reduce web requests, but somehow I couldn't make it. I don't know how to reduce request numbers without the two issues above resolved.

If greasyfork can provide an API to manage script sets, it may be possible to bundle several requests into one, and reduce many of the requests. The API can be simple, just like @hacker09 said, providing a .json file that contains all script sets and their data can be useful. In that case, I can reduce requests by roughly N/N+1 if the user have N sets in profile (by reducing requests from 1 request for sets list and N requests for sets' content to 1 reqeust for the .json file).

§
发表于:2024-06-30
编辑于:2024-06-30

For that case, create a manual button, or delay with a few days, that would automatically do a whole bunch of network requests, like once a week.

That way you can also track changes in other browsers etc etc...

Each time is too much, as I often open 30+ script pages, so an obvious delay of at least an hour should take place, but again some things may not be accurate for 1 hr.

Another option is, do a bunch of requests when the script is installed, then only when remove/add is actually clicked, so there's absolutely no need to make so many requests on each page load.

§
发表于:2024-06-30

My last sentence also supposes that the user won't use another browser just to manually add/remove a script from a set.

发表回复

登录以发表回复。