From 8c7afc46c98341bbdbe7bbfe07fe65379f701f71 Mon Sep 17 00:00:00 2001 From: Pierpaolo Follia Date: Wed, 8 Jan 2025 17:13:39 +0100 Subject: [PATCH] Always use bolt scheme in pools --- lib/src/routing/connection_registry.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/src/routing/connection_registry.rs b/lib/src/routing/connection_registry.rs index c6b67e0..a40e935 100644 --- a/lib/src/routing/connection_registry.rs +++ b/lib/src/routing/connection_registry.rs @@ -78,12 +78,19 @@ impl ConnectionRegistry { let registry = &self.connections; let servers = routing_table.resolve(); let url = NeoUrl::parse(self.config.uri.as_str())?; + // Convert neo4j scheme to bolt scheme to create connection pools + let scheme = match url.scheme() { + "neo4j" => "bolt", + "neo4j+s" => "bolt+s", + "neo4j+ssc" => "bolt+ssc", + _ => return Err(Error::UnsupportedScheme(url.scheme().to_string())), + }; for server in servers.iter() { if registry.contains_key(server) { continue; } - let uri = format!("{}://{}:{}", url.scheme(), server.address, server.port); + let uri = format!("{}://{}:{}", scheme, server.address, server.port); debug!("Creating pool for server: {}", uri); registry.insert( server.clone(),