raw api limit log

This commit is contained in:
xxq250 2025-02-28 22:13:01 +08:00
parent 8c61254a64
commit f8b601bc9f
1 changed files with 1 additions and 0 deletions

View File

@ -1182,6 +1182,7 @@ class ApplicationController < ActionController::Base
else
record_count = 1
end
Rails.logger.info("请求太快,请稍后再试。#{controller_name}::#{request.remote_ip}") if record_count > 100
tip_exception("请求太快,请稍后再试。") if record_count > 100
Rails.cache.write("request/#{controller_name}/#{Time.now.strftime('%Y%m%d%H')}/#{request.remote_ip}", record_count, expires_in: 1.hour)