Add helpful note to rest rate-limit error

The rate limiting error message used the term "tokens," which could be
easily misconstrued to refer to REST auth tokens, and not rate limit
leaky-bucket tokens. Since we don't expose the internals of the leaky
bucket to end-users, this error message is essentially just not good.
Without knowledge of a leaky bucket/GCRA, it really makes no sense.

Therefore, this changes the message to indicate that the "tokens" are
rate-limit tokens. It also adds a hint that there's a config setting
that can be changed to raise the limit, which further makes it more
understandable, and also provides a reasonable hint as to what setting
to change to alleviate this problem immediately. This makes it easier
for users to debug and less likely they have to read old docs/wait for help.
This commit is contained in:
Lucas Nicodemus 2021-06-19 01:01:48 -07:00
parent f4c894ea22
commit eb97bdd259
2 changed files with 2 additions and 1 deletions

View file

@ -27,6 +27,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
* Removed the old `ConfigFile` class. If you are updating a plugin, you should use `TShock.Config.Settings` instead of the accessor you were using. This is typically a really easy change. For most plugin authors, updating to the new config format is as simple as changing the reference to the old static config to point to the new location. If you were using this for your own configs, you should swap to using a `IConfigFile` (see `TShockAPI.Configuration.ConfigFile`). (@hakusaro, @bartico6)
* Added `Main.worldPathName` to `/worldinfo` command. Now, if you need to see what the location on disk for your world file is, you can simply run `/worldinfo` to find out. This is particularly helpful on Linux and macOS, where the world path isn't obvious. (@hakusaro)
* Correct rejection message in LandGolfBallInCupHandler to output the proper expected player id. (@drunderscore)
* Clarified the error mesage that the console is presented if a rate-limit is reached over REST to indicate that "tokens" actually refers to rate-limit tokens, and not auth tokens, and added a hint as to what config setting determines this. (@hakusaro, @patsore)
## TShock 4.5.4
* Fixed ridiculous typo in `GetDataHandlers` which caused TShock to read the wrong field in the packet for `usingBiomeTorches`. (@hakusaro, @Arthri)

View file

@ -117,7 +117,7 @@ namespace Rests
{
if (tokens >= TShock.Config.Settings.RESTMaximumRequestsPerInterval)
{
TShock.Log.ConsoleError("A REST login from {0} was blocked as it currently has {1} tokens", context.RemoteEndPoint.Address.ToString(), tokens);
TShock.Log.ConsoleError("A REST login from {0} was blocked as it currently has {1} rate-limit tokens and is at the RESTMaximumRequestsPerInterval thresold.", context.RemoteEndPoint.Address.ToString(), tokens);
tokenBucket[context.RemoteEndPoint.Address.ToString()] += 1; // Tokens over limit, increment by one and reject request
return new RestObject("403")
{