mirror of
https://github.com/internetee/registry.git
synced 2025-07-29 14:06:21 +02:00
Add current limits to the error message
This commit is contained in:
parent
16d4e4b4e6
commit
dbe1678430
6 changed files with 11 additions and 3 deletions
|
@ -32,7 +32,7 @@ module Epp
|
|||
def respond_with_session_limit_exceeded_error(exception)
|
||||
epp_errors.add(:epp_errors,
|
||||
code: '2502',
|
||||
message: 'Session limit exceeded, try again later')
|
||||
msg: Shunter.default_error_message)
|
||||
handle_errors
|
||||
log_exception(exception)
|
||||
end
|
||||
|
|
|
@ -9,6 +9,10 @@ module Shunter
|
|||
|
||||
BASE_CONNECTION = ENV['shunter_redis_connection'] || { host: 'redis', port: 6379 }
|
||||
|
||||
def default_error_message
|
||||
"Session limit exceeded. Current limit is #{default_threshold} in #{default_timespan} seconds"
|
||||
end
|
||||
|
||||
def default_timespan
|
||||
ENV['shunter_default_timespan'] || ONE_MINUTE
|
||||
end
|
||||
|
|
|
@ -105,6 +105,9 @@ class Epp::Domain < Domain
|
|||
max: Setting.ns_max_count
|
||||
}
|
||||
],
|
||||
'2502' => [ # Rate limit exceeded
|
||||
%i[base session_limit_exceeded],
|
||||
],
|
||||
]
|
||||
}
|
||||
end
|
||||
|
|
|
@ -62,7 +62,7 @@ module Epp
|
|||
2308 => 'Data management policy violation',
|
||||
2400 => 'Command failed',
|
||||
2501 => 'Authentication error; server closing connection',
|
||||
2502 => 'Session limit exceeded; server closing connection',
|
||||
2502 => Shunter.default_error_message,
|
||||
}.freeze
|
||||
private_constant :DEFAULT_DESCRIPTIONS
|
||||
|
||||
|
|
|
@ -236,6 +236,7 @@ class EppDomainInfoBaseTest < EppTestCase
|
|||
response_xml = Nokogiri::XML(response.body)
|
||||
assert_epp_response :session_limit_exceeded_server_closing_connection
|
||||
assert_correct_against_schema response_xml
|
||||
assert response.body.include?(Shunter.default_error_message)
|
||||
ENV["shunter_default_threshold"] = '10000'
|
||||
ENV["shunter_enabled"] = 'false'
|
||||
end
|
||||
|
|
|
@ -85,7 +85,7 @@ class EppResponseResultCodeTest < ActiveSupport::TestCase
|
|||
2308 => 'Data management policy violation',
|
||||
2400 => 'Command failed',
|
||||
2501 => 'Authentication error; server closing connection',
|
||||
2502 => 'Session limit exceeded; server closing connection'
|
||||
2502 => Shunter.default_error_message
|
||||
}
|
||||
assert_equal descriptions, Epp::Response::Result::Code.default_descriptions
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue