mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 05:05:45 +02:00
parent
93055acb3a
commit
9b4aa478bf
4 changed files with 90 additions and 9 deletions
|
@ -74,7 +74,7 @@ class Epp::SessionsController < EppController
|
|||
success = false
|
||||
end
|
||||
|
||||
if success && !connection_limit_ok?
|
||||
if success && EppSession.limit_reached?(@api_user.registrar)
|
||||
epp_errors << {
|
||||
msg: 'Authentication error; server closing connection (connection limit reached)',
|
||||
code: '2501'
|
||||
|
@ -143,12 +143,4 @@ class Epp::SessionsController < EppController
|
|||
def resource
|
||||
@api_user
|
||||
end
|
||||
|
||||
def connection_limit_ok?
|
||||
epp_session_count = EppSession.where(user_id: @api_user.registrar.api_users.ids)
|
||||
.where('updated_at >= ?', Time.zone.now - 1.second).count
|
||||
|
||||
return false if epp_session_count >= 4
|
||||
true
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue