lib/mongo/operation/shared/response_handling.rb
# Unpins the session if the session is pinned and the yielded to block
# raises errors that are required to unpin the session.
#
# @note This method takes the session as an argument because this module
#   is included in BulkWrite which does not store the session in the
#   receiver (despite Specifiable doing so).
#
# @param [ Session | nil ] Session to consider.
Unpins the session if the session is pinned and the yielded to block
raises errors that are required to unpin the session.
Unpins the session if the session is pinned and the yielded to block raises errors that are required to unpin the session .
def unpin_maybe(session)
        yield
      rescue Mongo::Error => e
        if session
          session.unpin_maybe(e)
        end
        raise
      end
def unpin_maybe ( session ) yield rescue Mongo :: Error => e if session session . unpin_maybe ( e ) end raise end
Unpins the session if the session is pinned and the yielded to block
raises errors that are required to unpin the session.
Unpins the session if the session is pinned and the yielded to block raises errors that are required to unpin the session .
session
<not_specific>
<not_specific>
Session to consider.
Session to consider .
note
This method takes the session as an argument because this module is included in BulkWrite which does not store the session in the receiver (despite Specifiable doing so).
This method takes the session as an argument because this module is included in BulkWrite which does not store the session in the receiver ( despite Specifiable doing so ) .