Skip to content
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

Localize Database Connections/Cursor Usage #1

Closed
ncloudioj opened this issue Aug 25, 2015 · 1 comment
Closed

Localize Database Connections/Cursor Usage #1

ncloudioj opened this issue Aug 25, 2015 · 1 comment

Comments

@ncloudioj
Copy link

In Zenko, all database queries are executed via two global connections/cursors. That might unnecessarily hold the connection resources and prevent other applications from accessing the database.

Better localize the connection usage, like create a new connection while executing a new query, and close it immediately once you're done using this connection. For example,

cursor = conn.cursor()
try:
   cursor.execute(...)
except:
   # error handling here
else:
   # do your stuff here
finally:
   cursor.close()
@matthewruttley
Copy link
Owner

Fixed in the most recent commit :)
I've abstracted it to a different function which opens and closes the connection when making a query: e470238

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants