-
Notifications
You must be signed in to change notification settings - Fork 76
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
Add session pool #229
Add session pool #229
Conversation
Update README Fix test
nebula3/gclient/net/SessionPool.py
Outdated
) | ||
return session | ||
except AuthFailedException as e: | ||
# if auth failed, close the pool |
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.
What if somehow the authentication failed not due to bad credentials, but because it was something wrong with the metaD? Will closing the pool still be valid in this case?
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.
Nice catch, I'll add check for the error code to handle the credential case specifically. For non-credential errors, the pool should remain open.
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.
Great Job!!!
Why we need a session pool
The purpose of adding the
session pool
is to solve the problem caused by improperly using the connection pool. For example, a common case is that the user generates a new session, executes a query, and releases the session in a loop, like:This will cause huge traffic in the meta service and may crash the service.
Usage
See
example/SessinPoolExample.py
for a more detailed example.The usage of the connection pool remains unchanged.
Limitation
There are some limitations:
space
in the DB before initializing the session pool.sessinPool.execute()
is called, the session will execute the query in the space set in the session pool config.