elk icon indicating copy to clipboard operation
elk copied to clipboard

Hashtag query causing rate limit throttling

Open johnsonm opened this issue 2 years ago • 1 comments

Pre-Checks

  • [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
  • [X] Providing a screenshot or video to reproduce the issue or show visually what was meant.
  • [ ] I am willing to provide a PR.

Describe the bug

I wrote a post that contained a hashtag (#elkzone). I saw the upper-left hashtag pane flicker. When I clicked "Publish", the screen flashed and nothing happened. In the console, I saw logs with a MastoHttpRateLimitError:

image

On the server were many (over 100) identical lines of

Rate limit hit (throttle): 70.229.193.23 GET /api/v2/search?q=elkzone&type=hashtags&limit=25&resolve=false&exclude_unreviewed=true

At the time, I had two Elk windows open so that I could write the post about Elk while looking through the interface.

Reproduction video or screenshot

(Included inline in description)

Additional Context

Client: Fedora 37 Linux, Firefox 108.0.1 Server: Glitch-soc

johnsonm avatar Jan 16 '23 14:01 johnsonm

Solve in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

stackblitz[bot] avatar Jan 16 '23 14:01 stackblitz[bot]

I had the same thing happen to me. The server admin graciously raised the API throttle cap from 300 (hits in 5 mins) to 600, but it's really not nice behavior to be doing this.

I'm happy to provide a snippet of server logs if needed, btw.

dilinger avatar Jan 21 '23 08:01 dilinger

Maybe we should start caching requests using @tanstack/vue-query?

piotrski avatar Jan 21 '23 15:01 piotrski

I ran into a similar issue today, and I think it would be helpful to report the cool-off time to the user instead of showing ERROR: MastoHttpRateLimitError: Too many requests. Based on my interactions with the official Mastodon front-end, I believe the error response includes information about when the rate limit will be lifted?

If this is the case, then maybe a quick fix is to at least provide more information to the end user so that they know when they can continue using the service as normal.

dmhowcroft avatar Jan 23 '23 14:01 dmhowcroft

I think this hits because of a bug in at least some cases, in which case the app probably isn't in a state to back off on its own? Going through a caching layer that knows how to dedupe requests might mitigate the bug (if I'm right) and even make such bugs easier to identify and fix, I would think.

johnsonm avatar Jan 23 '23 15:01 johnsonm

FWIW, Eugen just merged this commit to Mastodon main that will increase the rate limit significantly for app tokens and user tokens: https://github.com/mastodon/mastodon/commit/c6ef56fd5e8f2648a256ae1479ddc28d0164c602

DataDrivenMD avatar Feb 02 '23 01:02 DataDrivenMD

hit me just now on notifications tab and then home feed

ERROR: MastoHttpRateLimitError: Too many requests

rdela avatar Feb 21 '23 18:02 rdela

I haven't seen this happen again. I'm guessing that the behavior was a side effect of some other bug that has since been addressed.

johnsonm avatar Mar 29 '23 00:03 johnsonm