From 0f3d4602efa2eda4cf5056d237cac36b2cc012ea Mon Sep 17 00:00:00 2001 From: "g.denis" Date: Thu, 12 Mar 2020 21:45:59 +0100 Subject: Fix: Unable to drop previously connected-to database (#1152) * close connections + added to authors + changelog * check conn exists --- AUTHORS | 1 + changelog.rst | 1 + pgcli/completion_refresher.py | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/AUTHORS b/AUTHORS index 834b5995..18953bd8 100644 --- a/AUTHORS +++ b/AUTHORS @@ -105,6 +105,7 @@ Contributors: * BrownShibaDog * George Thomas(thegeorgeous) * Yoni Nakache(lazydba247) + * Gantsev Denis Creator: -------- diff --git a/changelog.rst b/changelog.rst index cc7cf941..59c4f1fd 100644 --- a/changelog.rst +++ b/changelog.rst @@ -11,6 +11,7 @@ Features: Bug fixes: * Fix warning raised for using `is not` to compare string literal +* Close open connection in completion_refresher thread Internal: --------- diff --git a/pgcli/completion_refresher.py b/pgcli/completion_refresher.py index a70d2f2b..cf0879fd 100644 --- a/pgcli/completion_refresher.py +++ b/pgcli/completion_refresher.py @@ -84,6 +84,10 @@ class CompletionRefresher(object): for callback in callbacks: callback(completer) + if not settings.get("single_connection") and executor.conn: + # close connection established with pgexecute.copy() + executor.conn.close() + def refresher(name, refreshers=CompletionRefresher.refreshers): """Decorator to populate the dictionary of refreshers with the current -- cgit v1.2.3