Skip to content

Commit

Permalink
[HCK-7941] Connecting twice after listing databases was failing on op…
Browse files Browse the repository at this point in the history
…ening the ssh tunnel (#116)

* Connecting twice after listing databases was failing on opening the ssh tunnel twice

* Make sure to not recreate ssh tunnel twice
  • Loading branch information
bigorn0 authored Sep 10, 2024
1 parent 1f1eabd commit f081aa9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion reverse_engineering/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ module.exports = {

async getDatabases(connectionInfo, logger, cb, app) {
const sshService = app.require('@hackolade/ssh-service');
await postgresService.disconnect(sshService);

try {
logInfo('Get databases', connectionInfo, logger);
Expand Down Expand Up @@ -78,7 +79,9 @@ module.exports = {
});

postgresService.setDependencies(app);
await postgresService.connect(connectionInfo, sshService, postgresLogger);
if (!connectionInfo.ssh) {
await postgresService.connect(connectionInfo, sshService, postgresLogger);
}
await postgresService.logVersion();
const schemasNames = await postgresService.getAllSchemasNames();

Expand Down

0 comments on commit f081aa9

Please sign in to comment.