lib/mongo/session/session_pool.rb
# End all sessions in the pool by sending the endSessions command to the server.
#
# @example End all sessions.
#   pool.end_sessions
#
# @since 2.5.0
End all sessions in the pool by sending the endSessions command to the server.
End all sessions in the pool by sending the endSessions command to the server .
def end_sessions
        while !@queue.empty?
          server = ServerSelector.get(mode: :primary_preferred).select_server(@cluster)
          op = Operation::Command.new(
            selector: {
              endSessions: @queue.shift(10_000).map(&:session_id),
            },
            db_name: Database::ADMIN,
          )
          context = Operation::Context.new(options: {
            server_api: server.options[:server_api],
          })
          op.execute(server, context: context)
        end
      rescue Mongo::Error, Error::AuthError
      end
def end_sessions while ! @queue . empty? server = ServerSelector . get ( mode : :primary_preferred ) . select_server ( @cluster ) op = Operation :: Command . new ( selector : { endSessions : @queue . shift ( 10_000 ) . map ( & :session_id ) , } , db_name : Database :: ADMIN , ) context = Operation :: Context . new ( options : { server_api : server . options [ :server_api ] , } ) op . execute ( server , context : context ) end rescue Mongo :: Error , Error :: AuthError end
End all sessions in the pool by sending the endSessions command to the server.
End all sessions in the pool by sending the endSessions command to the server .
example
End all sessions. pool.end_sessions
End all sessions . pool . end_sessions
since
None