Discourse API Generating 429

Hello,

I am trying to use the Discourse API to give silly responses in a forum. For example, if someone says “Linux” in a thread Discobot will respond “Do you mean GNU/Linux?”

It works, unless someone responds with the same phrase, then I get a bunch of 429 or empty responses for two minutes (it’s almost exactly two minutes), at which point the API will start handling responses normally again.

For example:

Linux
FOSS
dotnet
Java
Linux

This will function correctly. However:

Linux
FOSS
dotnet
Linux
Linux

This will break.

Any idea what the two minute window is pertaining to? We’ve played with the app.yml settings and adjusted API rate limits. It did not seem to have any effect.

Thank you!

We need more info. What is the API endpoint you are calling and getting 429?

1 Like
https://forum.domain.net/t/1000/highestPost.json

GET request on that

highestPost being the highest_post_number of the thread

That means that you are being rate limited. If you want to keep track of new posts, pooling like that is very inefficient. Can I suggest using webhooks ? That way you can react to new posts, instead of pooling even when nothing is happening.

Sure, I can take a gander at web-hooks.

Do you know how to disable the response rate-limits? I believe we’ve changed a few in the app.yml already, anything that pertained to API from this link:

Is this something specific in Nginx we need to explore?

There is a nginx template that is added by default. It’s will be one of the very first lines of the app.yml. You may want to remove the one about rate limits and rebuild for it to take effect.

3 Likes

w00t. Will try that. Thank you for the assistance!

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