★ wanayoo — archive 1999 https://github.com/darikg/PgcliSublime/pull/17Nouvelle recherche | Portail wanayoo
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

Improved connection handling #17

Open
wants to merge 5 commits into
base: master
from
Open

Conversation

@koljonen
Copy link
Contributor

@koljonen koljonen commented Jul 6, 2016

This PR fixes two things that have been bugging me.

  1. Close the executor connection when a view is closed. (I've been running out of connections.)
  2. Reconnect the executor when a connection has been broken (e.g. after a postgres restart).
koljonen and others added 4 commits Jun 29, 2016
Joakim Koljonen Joakim Koljonen
Joakim Koljonen Joakim Koljonen
@darikg
Copy link
Owner

@darikg darikg commented Jul 30, 2016

Thanks! I'll get a chance to look at this this week

logger.debug('Command: PgcliExecute: %r', sql)
save_mode = get(view, 'pgcli_save_on_run_query_mode')

try: # Check if the connection has died
executor.conn.cursor().execute('select 1')

This comment has been minimized.

@darikg

darikg Aug 1, 2016
Owner

This is the only part I'm unsure of. Can we move the if executor.conn.closed check to the main except psycopg2.DatabaseError below, and avoid the constant overhead of an additional command on every execution?

Joakim Koljonen Joakim Koljonen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.