26 replies · 250 views · thread synced · 5 days ago
· View on torn.com
About this thread
Posts archived:27 / 27 posts (100%) · the total is Torn's reply count + the opening post at the last fetch
Counted by TornLife from the archived posts.
Archived posts
27
Discussion span
→
Authority score
71 / 100
Historical score
38 / 100
Story score
37 / 100
Engagement score
63 / 100
People posting, likes and official posts are not counted for this thread yet: on threads longer than one page they come from a periodic pass over the archive, which has not covered it.
Most-liked replies
Helcostr[1934501]Wiki Editor
· 1 likes · Reason why I am requesting that the torn API supply the rate limit for my bot to interpret, is because we, theoretically, have infinite amount of devices accessing that specific key. And if each bot has its own rate limit, …
While the 100 hits per minute is an approximate number, it changes "without notice to ensure the Torn servers remain stable" (see http://api.torn.com/), is there a way to implement a rate limit feed back, letting the bot know when is the next possible request that it can send?
Edit: To make my question clearer, here is the scenario: having multiple bots running simultaneously on their own rate-limit clock can cause problems. The most extreme case is if you have 2 bots running at max speed within the rules, but ignoring each other. 100 requests per minute + 100 requests per minute will equal 200 requests per minute combined on both bots, clearly violating the API rate limit. So my request is: is there a time stamp feedback the bot can receive on API limiting? There isn't any documentation on it.
Reason why I am requesting that the torn API supply the rate limit for my bot to interpret, is because we, theoretically, have infinite amount of devices accessing that specific key. And if each bot has its own rate limit, without a care of what the others are using, then its very easy to overload the server.
Realistically, I have been rate limiting with such a timer that you have suggested. But as I stated before, the rate limit can change, other bots can be using the key, ect.
Players know the risks, sure (or maybe), but I see the motivation of creating stable tools with some error handling (or more: error prevention).
I think as developers, we should worry about the requests we do with API keys, so this is on my opinion a valid question and would be a useful addition in the API handling.
While I have not created any formal applications using the API I would like to think that you wouldnt need to spam it too much so that you lock a key. It should be more then enough requests for a user. As mentioned before just track your own API calls and make sure you arent doing something stupid like updating every second. I know full well that most other applications have a adjustable variable so that the USER can adjust how often its contacts the API, this way there much less of a chance of overloading their key.
Yes we don't know exactly what other tools do and where a user uses the API key. But wouldn't it be nice to prevent by design that tools do not block the API key?
I can imagine several use cases where multiple calls per minute could be interesting (like getting information about your own faction members, as one example).
You can't control what others scripts do, this is true. But the API response could maybe give at least a hint ;-) That's all echoblast53 is asking for. I am not saying that the suggested way is the golden solution for this purpose, but just saying 'we don't need something like this, it's the users risk' is too simple in my opinion.
I still think: error prevention > error handling. At least this should be a developers motivation.
... so apparently I have a worst time explaining. See Byroid's comment XD
And I also agree: error prevention trumps error handling. Which is why I deleted 5 other custom bots running on a 1 minute interval each to give my 2 second bot and my 30 second bot some breathing room.
Also, the timer you refer to doesn't have to make 1 api call. 1 program probably has to make 2-5 calls per cycle to get its info, or maybe 2 calls cycling at a fast rate, with 3 more low priority calls cycling on a very long delay. With multiple programs that don't share the information across the board, it can get hectic on usage real quickly, resulting in maybe 3 maximum users.
The following is probably the most relevant to respond to you Gaming
I am not referring to spamming at 500 milliseconds. I am just referring to the fact that when you add bots to your api access, you probably will forget that you have it accessing. So when it comes time to add more applications, it would be nice to use the ratelimit info to restrict the bots, instead of going to the drawing board, counting how many bots you have, how many seconds u can spare, and readjusting the bots accordingly.
I mostly just wanted to dig a little deeper into reasoning.
I completely agree it would be nice, im just being stubborn lol and cant see it providing much use. A poll or survey would be cool to see how many plugins/applications people use which take advantage of the API. If you guys know of one, then feel free to link it.
then you should make server side requests, each one storing the API key usage in the database so that any device can track when the API key has reached the limit.
I have thought about it. But now you are restricting your used programs to only your custom programs. Meanwhile, programs like DocTorn won't be on this system.
Or something close to it. At least it is better than nothing.
Torn API does exactly this: every time you do an API request, Torn keeps track of the number of requests and their date/time (and stores them in a database I guess).
Firstly, as a responsible developer no one in their right mind would use 180 requests in 2 seconds. You should try and spread out the requests.
Also, I think you missed the point a bit, you also keep track of how many requests are happening and if it is too many, then dont allow it and probably display a message telling the user to slow down.
Now I suggest you take a quick peek at the source code for TornCityAPISharp and youll very quickly see we implement this very technique.