Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Connection's transport connection to stay open #219

Open
kadler opened this issue Mar 31, 2020 · 2 comments
Open

Allow Connection's transport connection to stay open #219

kadler opened this issue Mar 31, 2020 · 2 comments
Labels
enhancement New feature or request keep-open Exempts stale action from auto closing the issue/pr.

Comments

@kadler
Copy link
Member

kadler commented Mar 31, 2020

Is your feature request related to a problem? Please describe.

Performance is not ideal with the current Connection behavior.

Describe the solution you'd like

Currently, Connection objects connect/disconnect on each call. We should have an option to have it connect once and stay open until the user explicitly disconnects for the transports that support such things (idb, odbc, ssh). This would have to be opt-in, as the user would then be necessary for closing out connections that would otherwise be leaked.

The proposed solution would be something like

const conn = new Connection({
  transport: 'ssh',
  transportOptions: { host: 'myhost', username: 'myuser', password: 'mypassword' },
  persistent: true,  // or keepOpen or whatever
});
conn.add(...);

conn.run(...); // transport is implicitly opened
conn.run(...); // transport is re-used

conn.close();

conn.run(...); // transport is implicitly opened again

In this example the connection still implicitly opens the connection, it's just the user responsible for closing it. Alternatively, we could have the user explicitly open it as well.

When using the existing behavior, close() would be a no-op.

@kadler kadler added the enhancement New feature or request label Mar 31, 2020
@github-actions
Copy link

github-actions bot commented May 1, 2020

👋 Hi! This issue has been marked stale due to inactivity. If no further activity occurs, it will automatically be closed.

@github-actions github-actions bot added the stale label May 1, 2020
@abmusse abmusse added the keep-open Exempts stale action from auto closing the issue/pr. label May 1, 2020
@github-actions github-actions bot closed this as completed Oct 6, 2020
@kadler kadler removed the stale label Oct 6, 2020
@kadler kadler reopened this Oct 6, 2020
@worksofliam
Copy link
Member

Hey @kadler, what's the status here? Is this kind of functionality likely to be get implemented by someone else?

Is it worth me spending the time to create a PR for this and let it get reviewed?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request keep-open Exempts stale action from auto closing the issue/pr.
Projects
None yet
Development

No branches or pull requests

3 participants