User_10_sec_limiet

Vertraag, u maakt te veel verzoeken.
Probeer het over 5 seconden opnieuw.
Foutcode: user_10_secs_limit.

Ik heb een thema gemaakt dat await ajax(/t/${this.args.topic.id}.json); gebruikt. Dit wordt rate-limited vanwege excessieve verzoeken. Hoe kan ik dit voorkomen? Ik merkte dat de beperking is gemarkeerd als een gebruikersniveau limiet, geen IP-gebaseerde limiet.

Zit je achter een load balancer zoals Cloudflare, zodat Discourse het werkelijke IP-adres van de gebruiker niet kent?

Een snelle grep en ik zie user_10_secs_limit nergens in de code, behalve in een spec. Ik vermoed dat het IP-gerelateerd is, ondanks de fout die je ziet.

Here - You can’t grep it :slight_smile:

error_code: "#{error_code_identifier}_10_secs_limit",

Coming from discourse/lib/request_tracker/rate_limiters/user.rb at main · discourse/discourse · GitHub

@truman is your theme component doing this for many topics? What exactly are you trying to accomplish? You should either see if you can combine the calls, for instance by tagging the topics and then retrieving them by tag in a single call, and/or you should figure out a cache mechanism.

2 likes

Aha! I figured I was overlooking something simple. . .

1 like

I want to fetch the reactions for each topic so that I can display them on the homepage. like:
image

You need serialise this in a plugin to avoid all these queries so all the data you need is brought down in one go.

You should not have to fire off a query for every topic in your topic list. That’s never going to scale.

For an example of where this is done take a look at Topic List Previews.

4 likes

Haal de all-the-plugins repo op en zoek naar add_to_serializer

3 likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.