DEV: Remove usages of RateLimiter.clear_all! (#247)

c.f. https://github.com/discourse/discourse/pull/22103
This commit is contained in:
Martin Brennan 2023-06-15 09:39:08 +10:00 committed by GitHub
parent c31d33a50c
commit b011f3ef8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 9 deletions

View File

@ -194,13 +194,14 @@ describe DiscourseDataExplorer::QueryController do
) )
end end
before { RateLimiter.enable }
use_redis_snapshotting
it "limits query runs from API when using block mode" do it "limits query runs from API when using block mode" do
global_setting :max_data_explorer_api_reqs_per_10_seconds, 1 global_setting :max_data_explorer_api_reqs_per_10_seconds, 1
global_setting :max_data_explorer_api_req_mode, "block" global_setting :max_data_explorer_api_req_mode, "block"
RateLimiter.enable
RateLimiter.clear_all!
admin = Fabricate(:admin) admin = Fabricate(:admin)
api_key = Fabricate(:api_key, user: admin) api_key = Fabricate(:api_key, user: admin)
@ -226,9 +227,6 @@ describe DiscourseDataExplorer::QueryController do
global_setting :max_data_explorer_api_reqs_per_10_seconds, 1 global_setting :max_data_explorer_api_reqs_per_10_seconds, 1
global_setting :max_data_explorer_api_req_mode, "warn" global_setting :max_data_explorer_api_req_mode, "warn"
RateLimiter.enable
RateLimiter.clear_all!
admin = Fabricate(:admin) admin = Fabricate(:admin)
api_key = Fabricate(:api_key, user: admin) api_key = Fabricate(:api_key, user: admin)
@ -249,9 +247,6 @@ describe DiscourseDataExplorer::QueryController do
global_setting :max_data_explorer_api_reqs_per_10_seconds, 1 global_setting :max_data_explorer_api_reqs_per_10_seconds, 1
global_setting :max_data_explorer_api_req_mode, "block" global_setting :max_data_explorer_api_req_mode, "block"
RateLimiter.enable
RateLimiter.clear_all!
query = make_query("SELECT 23 as my_value") query = make_query("SELECT 23 as my_value")
freeze_time freeze_time