<commit_before>require 'active_support/core_ext/hash'
require 'active_support/ordered_options'

module Neo4j
  class SessionManager
    class << self
      def open_neo4j_session(type, url_or_path, wait_for_connection = false, options = {})
        enable_unlimited_strength_crypto! if java_platform? && session_type_is_embedded?(type)

        adaptor = wait_for_value(wait_for_connection, Neo4j::Core::CypherSession::ConnectionFailedError) do
          verbose_query_logs = Neo4j::Config.fetch(:verbose_query_logs, false)
          cypher_session_adaptor(type, url_or_path, options.merge(wrap_level: :proc,
                                                                  verbose_query_logs: verbose_query_logs))
        end

        Neo4j::Core::CypherSession.new(adaptor)
      end

      def adaptor_class(type, options)
        options[:adaptor_class] || adaptor_class_by_type(type.to_sym)
      end

      protected

      def session_type_is_embedded?(session_type)
        [:embedded_db, :embedded].include?(session_type)
      end

      def enable_unlimited_strength_crypto!<commit_msg>Fix wait_for_connection not waiting for connection<commit_after>require 'active_support/core_ext/hash'
require 'active_support/ordered_options'

module Neo4j
  class SessionManager
    class << self
      def open_neo4j_session(type, url_or_path, wait_for_connection = false, options = {})
        enable_unlimited_strength_crypto! if java_platform? && session_type_is_embedded?(type)

        wait_for_value(wait_for_connection, Neo4j::Core::CypherSession::ConnectionFailedError) do
          verbose_query_logs = Neo4j::Config.fetch(:verbose_query_logs, false)
          adaptor = cypher_session_adaptor(type, url_or_path, options.merge(wrap_level: :proc,
                                                                            verbose_query_logs: verbose_query_logs))
          session = Neo4j::Core::CypherSession.new(adaptor)
          # NOTE: query version to test if connection is available
          session.version if wait_for_connection
          session
        end
      end

      def adaptor_class(type, options)
        options[:adaptor_class] || adaptor_class_by_type(type.to_sym)
      end

      protected

      def session_type_is_embedded?(session_type)
        [:embedded_db, :embedded].include?(session_type)
      end

      def enable_unlimited_strength_crypto!
{'fraction_non_alphanumeric': 0.07537688442211055, 'fraction_numerical': 0.0041876046901172526, 'mean_word_length': 3.0907534246575343, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2733949', 'n_tokens_mistral': 718, 'n_tokens_neox': 679, 'n_words': 118}