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

Add session persistence #53

Merged
merged 1 commit into from
Apr 24, 2015
Merged

Add session persistence #53

merged 1 commit into from
Apr 24, 2015

Conversation

dguerri
Copy link
Contributor

@dguerri dguerri commented Mar 27, 2015

Besides improving performances, this change will make it possible to
use scp as a "drop-in" replacement to paramiko sftp.

@remram44
Copy link
Collaborator

This means that we must now call close() explicitely if we don't use the context manager.

Should get() and put() close the session if it was not already open?
Or do we just not care about leaving sessions open until the GC gets to them?

(also: we usually write 'persistence')

@dguerri
Copy link
Contributor Author

dguerri commented Mar 29, 2015

Hi @remram44.
I have fixed the grammar issue in the commit message. Thanks.

About get() and put(), you are right. If the user forget to close() SCP session, this will be eventually done by the GC.
Using a with statement, that is done by __exit__() method.

This PR should be backward compatible and it just introduces a small performance improvement.

@remram44
Copy link
Collaborator

The only thing I see here, is that if we consider that the GC close()ing is fine, we don't need the context manager either.

@dguerri
Copy link
Contributor Author

dguerri commented Mar 29, 2015

Not sure I get what you mean by saying that GC close()ing is fine.
If we are worried about user leaving session opened, we can rest assured CG will take care of that. Nevertheless, releasing resources as soon as they are no longer needed, is always a good practice.

@dguerri dguerri changed the title Add session persistency Add session persistence Apr 1, 2015
@jbardin
Copy link
Owner

jbardin commented Apr 24, 2015

Hi @dguerri,

This looks good.

Can you just drop the __version__ line before I merge this? (I'll bump the version to 0.10.0 with a tagged release)

Besides improving performances, this change will make it possible to
use scp as a "drop-in" replacement to paramiko sftp.
@dguerri
Copy link
Contributor Author

dguerri commented Apr 24, 2015

Sure, thanks!

jbardin pushed a commit that referenced this pull request Apr 24, 2015
Add session persistence
@jbardin jbardin merged commit a57e683 into jbardin:master Apr 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants