Skip to content

Commit f081aa9

Browse files
authored
[HCK-7941] Connecting twice after listing databases was failing on opening 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
1 parent 1f1eabd commit f081aa9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

reverse_engineering/api.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ module.exports = {
3838

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

4243
try {
4344
logInfo('Get databases', connectionInfo, logger);
@@ -78,7 +79,9 @@ module.exports = {
7879
});
7980

8081
postgresService.setDependencies(app);
81-
await postgresService.connect(connectionInfo, sshService, postgresLogger);
82+
if (!connectionInfo.ssh) {
83+
await postgresService.connect(connectionInfo, sshService, postgresLogger);
84+
}
8285
await postgresService.logVersion();
8386
const schemasNames = await postgresService.getAllSchemasNames();
8487

0 commit comments

Comments
 (0)