-
Notifications
You must be signed in to change notification settings - Fork 197
Read without writer #158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read without writer #158
Conversation
neo4j/addressing.py
Outdated
context = {} | ||
parameters = [x for x in query.split('&') if x] | ||
for keyValue in parameters: | ||
pair = keyValue.split('=') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
key, _, value = keyValue.partition("=")
if not key or not value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
neo4j/v1/direct.py
Outdated
@@ -56,6 +56,8 @@ def __init__(self, uri, **config): | |||
# will carry out DNS resolution, leading to the possibility that | |||
# the connection pool may contain multiple IP address keys, one for | |||
# an old address and one for a new address. | |||
if SocketAddress.parse_routing_context(uri): | |||
raise ValueError("Routing parameters are not supported with scheme 'bolt'. Given URI: '%s'." % uri) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no Routing
neo4j/v1/routing.py
Outdated
""" Indicator for whether routing information is still usable. | ||
""" | ||
expired = self.last_updated_time + self.ttl <= self.timer() | ||
return not expired and len(self.routers) > 1 and self.readers and self.writers | ||
has_server_for_mode = (access_mode == READ_ACCESS and self.readers) or (access_mode == WRITE_ACCESS and self.writers) | ||
return not expired and len(self.routers) >= 1 and has_server_for_mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and self.routers
neo4j/v1/routing.py
Outdated
if ServerVersion.from_str(connection.server.version).at_least_version(3, 2): | ||
return self.call_get_routing_table, {self.get_routing_table_param: self.routing_context} | ||
else: | ||
return self.call_get_servers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return self.call_get_servers, {}
neo4j/v1/routing.py
Outdated
@@ -169,8 +182,9 @@ def fetch_routing_info(self, address): | |||
if routing support is broken | |||
""" | |||
try: | |||
with BoltSession(lambda _: self.acquire_direct(address)) as session: | |||
return list(session.run("CALL %s" % self.routing_info_procedure)) | |||
connection = self.acquire_direct(address) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
connections = [None]
def connector(_):
connection = self.acquire_direct(address)
connections[0] = connection
return connection
with BoltSession(connector) as session:
last_connection = connections[0]
neo4j/v1/routing.py
Outdated
# None of the routers have been successful, so just fail | ||
raise ServiceUnavailable("Unable to retrieve routing information") | ||
|
||
def refresh_routing_table(self): | ||
def ensure_routing_table(self, access_mode): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ensure_routing_table_is_fresh
0e3d67e
to
1cc9ac8
Compare
1cc9ac8
to
fe7554e
Compare
87677b0
to
3cb094a
Compare
Based on #157 supporting routing context in bolt uri