Skip to content

refactor(database): one SshTunnelHost mixin instead of four copies of the tunnel code (#1508) - #1716

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
refactor/ssh-tunnel-mixin
Oct 18, 2026
Merged

ZhuchkaTriplesix merged 1 commit into
devfrom
refactor/ssh-tunnel-mixin

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Closes #1508

PostgresConnection, MysqlConnection, MongoConnection and RedisConnection each carried the same fields, the secrets lookup, the openTunnel call and the release in disconnect / forceClose / the connect error path.

SshTunnelHost (core/database/ssh_tunnel_host.dart) now holds the handle and the steps: openSshTunnel (reads the stored secrets when none were passed, null when the tunnel is off), adoptSshTunnel, forgetSshTunnel (MySQL's superseded connect attempt) and releaseSshTunnel (optional log label). No behaviour change: the release sites still log under the same labels, MySQL still checks its connect generation between opening and adopting, MongoDB still tunnels to the first seed host.

About 150 lines fewer. Test: no tunnel without a config or when disabled; releasing with none open is harmless.

@github-actions github-actions Bot added core Core library logic and services connections Database connections, URI parsing, pools backend Backend database driver execution and queries P2 Medium priority / Parity & Refactoring labels Oct 18, 2026
@github-actions github-actions Bot added this to the 0.5.0 milestone Oct 18, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 05ba445 into dev Oct 18, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Backend database driver execution and queries connections Database connections, URI parsing, pools core Core library logic and services P2 Medium priority / Parity & Refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant