api: add rate limit to /explore/posts/popular.json endpoint.

Add a rate limit of 1 request per minute to the /explore/posts/popular.json endpoint.
This is to deal with a particular bot checking this page multiple times
per second.
This commit is contained in:
evazion
2021-12-09 23:08:29 -06:00
parent 36985e9590
commit 514c57ce58

View File

@@ -2,6 +2,8 @@ module Explore
class PostsController < ApplicationController
respond_to :html, :xml, :json
rate_limit :popular, rate: 1.0/1.minute, burst: 50, if: -> { request.format.json? }, key: "explore:popular.json"
def popular
@date, @scale, @min_date, @max_date = parse_date(params)