diff --git a/lib/features/postgresql/postgres_routine_view.dart b/lib/features/postgresql/postgres_routine_view.dart index 36af6bf4..be35ce52 100644 --- a/lib/features/postgresql/postgres_routine_view.dart +++ b/lib/features/postgresql/postgres_routine_view.dart @@ -61,18 +61,13 @@ class _PostgresRoutineViewState extends material.State { } _definitionControllers.clear(); _scrollController.dispose(); - _disconnectCurrent(interruptIfBusy: true); + _disconnectCurrent(); super.dispose(); } - void _disconnectCurrent({bool interruptIfBusy = false}) { - if (interruptIfBusy && _loading) { - PostgresService.instance.interrupt( - widget.connectionRow, - database: widget.database, - mode: PgSessionMode.readOnly, - ); - } + /// Releases the lease. The session is shared with the tree, the table tabs + /// and MCP, so closing this view never interrupts it. + void _disconnectCurrent() { _lease?.release(); _lease = null; } diff --git a/lib/features/postgresql/postgres_sequence_view.dart b/lib/features/postgresql/postgres_sequence_view.dart index 08083997..5dfeb6bb 100644 --- a/lib/features/postgresql/postgres_sequence_view.dart +++ b/lib/features/postgresql/postgres_sequence_view.dart @@ -53,18 +53,13 @@ class _PostgresSequenceViewState extends material.State { @override void dispose() { _scrollController.dispose(); - _disconnectCurrent(interruptIfBusy: true); + _disconnectCurrent(); super.dispose(); } - void _disconnectCurrent({bool interruptIfBusy = false}) { - if (interruptIfBusy && _loading) { - PostgresService.instance.interrupt( - widget.connectionRow, - database: widget.database, - mode: PgSessionMode.readOnly, - ); - } + /// Releases the lease. The session is shared with the tree, the table tabs + /// and MCP, so closing this view never interrupts it. + void _disconnectCurrent() { _lease?.release(); _lease = null; }