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

Improve ExternalBackend context handling #587

Merged
merged 2 commits into from
Mar 28, 2022

Conversation

ghjm
Copy link
Contributor

@ghjm ghjm commented Mar 25, 2022

The current implementation of ExternalBackend does not allow a library user to know when a connection has ended. This PR adds a context at the ExternalSession level, which an external caller can monitor to detect when the connection is finished.

While looking into this, I found that when an ExternalSession is closed, it calls the cancel function of the whole ExternalBackend, which implies there can only ever be one session per backend. However, the created context is not saved correctly, so the cancel function doesn't actually have any effect on anything. This PR creates a new context object at the ExternalSession level, which can track and be cancelled by a session, without cancelling its parent backend.

@ghjm ghjm force-pushed the external_backend_context branch 4 times, most recently from fbee48a to 2e5055f Compare March 25, 2022 23:00
@ghjm
Copy link
Contributor Author

ghjm commented Mar 25, 2022

The test flake is strong today

@fosterseth
Copy link
Member

@shanemcd looks good to me if it works for you

@shanemcd shanemcd merged commit 79c64d2 into ansible:devel Mar 28, 2022
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