You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I found a bug in driver/cluster.py, which happend when using coroutines to send requests to gremlin-server. The impact is that redundant GremlinServers and its hosts will be established.
async def get_connection(self, hostname=None):
"""
**coroutine** Get connection from next available host in a round robin
fashion.
:returns: :py:class:`Connection<aiogremlin.driver.connection.Connection>`
"""
if not self._hosts:
await self.establish_hosts()
if hostname:
try:
host = self._hostmap[hostname]
except KeyError:
raise exception.ConfigError(
'Unknown host: {}'.format(hostname))
else:
host = self._hosts.popleft()
conn = await host.get_connection()
self._hosts.append(host)
return conn
When self._hosts.popleft(), the variable host could be empty, which lead to other coroutines found that not self._hosts is True and establish a new one. Moving self._hosts.append(host) ahead of conn = await host.get_connection() can fix it.
The text was updated successfully, but these errors were encountered:
Hello! I found a bug in
driver/cluster.py
, which happend when using coroutines to send requests to gremlin-server. The impact is that redundant GremlinServers and its hosts will be established.When
self._hosts.popleft()
, the variablehost
could be empty, which lead to other coroutines found thatnot self._hosts
isTrue
and establish a new one. Movingself._hosts.append(host)
ahead ofconn = await host.get_connection()
can fix it.The text was updated successfully, but these errors were encountered: