mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-12-24 16:10:33 -06:00
Purge connections from the cache on logout. Fixes #3703
This commit is contained in:
parent
ce31726af5
commit
822d384746
@ -20,4 +20,5 @@ Bug fixes
|
||||
| `Bug #3638 <https://redmine.postgresql.org/issues/3638>`_ - Fix syntax error when creating new pgAgent schedules with a start date/time and exception.
|
||||
| `Bug #3674 <https://redmine.postgresql.org/issues/3674>`_ - Cleanup session files periodically.
|
||||
| `Bug #3660 <https://redmine.postgresql.org/issues/3660>`_ - Rename the 'SQL Editor' section of the Preferences to 'Query Tool' as it applies to the whole tool, not just the editor.
|
||||
| `Bug #3700 <https://redmine.postgresql.org/issues/3700>`_ - Fix connection garbage collector.
|
||||
| `Bug #3700 <https://redmine.postgresql.org/issues/3700>`_ - Fix connection garbage collector.
|
||||
| `Bug #3703 <https://redmine.postgresql.org/issues/3703>`_ - Purge connections from the cache on logout.
|
@ -550,6 +550,13 @@ def create_app(app_name=None):
|
||||
def force_session_write(app, user):
|
||||
session.force_write = True
|
||||
|
||||
@user_logged_out.connect_via(app)
|
||||
def clear_current_user_connections(app, user):
|
||||
from config import PG_DEFAULT_DRIVER
|
||||
from pgadmin.utils.driver import get_driver
|
||||
_driver = get_driver(PG_DEFAULT_DRIVER)
|
||||
_driver.gc_own()
|
||||
|
||||
##########################################################################
|
||||
# Load plugin modules
|
||||
##########################################################################
|
||||
|
@ -207,6 +207,22 @@ class Driver(BaseDriver):
|
||||
]:
|
||||
mgr.release()
|
||||
|
||||
def gc_own(self):
|
||||
"""
|
||||
Release the connections for current session
|
||||
This is useful when (eg. logout) we want to release all
|
||||
connections (except dedicated connections created by utilities
|
||||
like backup, restore etc) of all servers for current user.
|
||||
"""
|
||||
|
||||
sess_mgr = self.managers.get(session.sid, None)
|
||||
|
||||
if sess_mgr:
|
||||
for mgr in (
|
||||
m for m in sess_mgr.values() if isinstance(m, ServerManager)
|
||||
):
|
||||
mgr.release()
|
||||
|
||||
@staticmethod
|
||||
def qtLiteral(value):
|
||||
adapted = adapt(value)
|
||||
|
Loading…
Reference in New Issue
Block a user