Skip to content

Commit

Permalink
Allow ems to terminate connection after use
Browse files Browse the repository at this point in the history
This commit adds a simple disconnect hook that allows ext management
systems (providers) to terminate connection after it is no longer
needed.

Use case for such functionality is provider that needs to delete user
session after the operation since user sessions are long-lived and
number of concurrent live sessions is limited.
  • Loading branch information
Tadej Borovšak committed Sep 8, 2018
1 parent 85265cd commit ff9b80a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/models/ext_management_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,13 @@ def emstype_description
def with_provider_connection(options = {})
raise _("no block given") unless block_given?
_log.info("Connecting through #{self.class.name}: [#{name}]")
yield connect(options)
connection = connect(options)
yield connection
ensure
disconnect(connection) if connection
end

def disconnect(_connection)
end

def self.refresh_all_ems_timer
Expand Down

0 comments on commit ff9b80a

Please sign in to comment.