truman
(truman)
9 ביולי, 2025, 7:28am
1
Slow down, you're making too many requests.
Please retry again in 5 seconds.
Error code: user_10_secs_limit.
I created a theme that uses await ajax(/t/${this.args.topic.id}.json);
. This gets rate-limited due to excessive requests. How can I avoid this? I noticed the restriction is flagged as a user-level limit , not an IP-based limit.
pfaffman
(Jay Pfaffman)
9 ביולי, 2025, 2:11pm
2
Are you behind a load balancer like cloudflare so that Discourse doesn’t know the user’s actual IP address?
A quick grep and I don’t see user_10_secs_limit
in the code except in a spec. I suspect it might be IP related in spite of the error you are seeing.
RGJ
(Richard - Communiteq)
9 ביולי, 2025, 3:00pm
3
Here - You can’t grep it
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 לייקים
pfaffman
(Jay Pfaffman)
9 ביולי, 2025, 3:06pm
4
Aha! I figured I was overlooking something simple. . .
לייק 1
truman
(truman)
10 ביולי, 2025, 2:50am
5
I want to fetch the reactions for each topic so that I can display them on the homepage. like:
merefield
(Robert)
10 ביולי, 2025, 5:13am
6
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.
# frozen_string_literal: true
module TopicPreviews
module TopicListItemSerializerExtension
extend ActiveSupport::Concern
include TopicListItemEditsMixin
included do
attributes :sidecar_installed,
:dominant_colour,
:dominant_color,
:include_dominant_colour?,
:topic_post_id,
:topic_post_liked,
:topic_post_like_count,
:topic_post_can_like,
:topic_post_can_unlike,
:topic_post_bookmarked,
:topic_post_is_current_users,
This file has been truncated. show original
4 לייקים
pfaffman
(Jay Pfaffman)
10 ביולי, 2025, 1:27pm
7
Get the all-the-plugins repo and look for add_to_serializer
3 לייקים
system
(system)
נסגר ב־
9 באוגוסט, 2025, 1:28pm
8
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.