get_session_with_lock

in lib/aws/session_store/dynamo_db/locking/pessimistic.rb [21:38]


    def get_session_with_lock(env, sid)
      expires_at = nil
      result = nil
      max_attempt_date = Time.now.to_f + @config.lock_max_wait_time
      while result.nil?
        exceeded_wait_time?(max_attempt_date)
        begin
          result = attempt_set_lock(sid)
        rescue Aws::DynamoDB::Errors::ConditionalCheckFailedException
          expires_at ||= get_expire_date(sid)
          next if expires_at.nil?
          result = bust_lock(sid, expires_at)
          wait_to_retry(result)
        end
      end
      get_data(env, result)
    end