Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Avoid resetting rack-attack outside tests

Oliver Güntherf85119397371
diff --git a/lib/open_project/rate_limiting.rb b/lib/open_project/rate_limiting.rb
index 8850649c630..9d252e12739 100644
--- a/lib/open_project/rate_limiting.rb
+++ b/lib/open_project/rate_limiting.rb
@@ -14,7 +14,6 @@ module OpenProject
end
def set_defaults!
- Rack::Attack.reset!
Rack::Attack.clear_configuration
Rack::Attack.throttled_responder = ->(request) { OpenProject::RateLimiting.throttled_response(request) }
diff --git a/spec/support/shared/with_rack_attack.rb b/spec/support/shared/with_rack_attack.rb
index 32ff0560f3e..3dd93b574a9 100644
--- a/spec/support/shared/with_rack_attack.rb
+++ b/spec/support/shared/with_rack_attack.rb
@@ -27,6 +27,7 @@
RSpec.configure do |config|
config.around :example, :with_rack_attack do |example|
Rack::Attack.enabled = true
+ Rack::Attack.reset!
OpenProject::RateLimiting.set_defaults!
example.run