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

Thoughts on attempt at trio and wsproto integration #124

Closed
merrellb opened this issue Apr 17, 2017 · 4 comments
Closed

Thoughts on attempt at trio and wsproto integration #124

merrellb opened this issue Apr 17, 2017 · 4 comments

Comments

@merrellb
Copy link

So I've taken my first stab at writing a trio integration, using wsproto (@njsmith I've seen your contributions over there so if you already have a better integration with trio do let me know :-)

https://github.com/merrellb/trio_libs

I am particularly curious about any thoughts on my cancellable scope factory (is there any easier way to shutdown a single Websocket gracefully?) as well as my socket and nursery scope management base class (hopefully I have those nested correctly). Also wasn't sure if a shutdown task (awaiting a shutdown event) is best-practice. Basically, any feedback is much appreciated :-)

One issue I am running into is KeyboardInterrupt handling and allowing a graceful shutdown. I've solved the initial issue with the socket closing prematurely (thanks for responding so quickly to my ticket) but it still seems to hang on occasion requiring a double-control-c. The eventual tracebacks are inconsistent, making it a bit hard to unravel.

My apologies if a ticket is not the best way to solicit feedback but figured some other folks would be interested in seeing an attempt at some trio code.

@merrellb merrellb changed the title Thoughts on my attempt at trio and wsproto integration Thoughts on attempt at trio and wsproto integration Apr 17, 2017
@njsmith
Copy link
Member

njsmith commented Apr 17, 2017

Hey, this is great! Two quick thoughts before I look at the actual code:

@merrellb
Copy link
Author

  • I am subscribed to the issue but totally forgot to pin my trio version. TODO requirements.txt
  • I am on the latest OSX (errr MacOs)

@merrellb
Copy link
Author

A quick update. I think I've managed to conquer the KeyboardInterrupt problems. The main issue was that I couldn't figure out how to wrap the implicit await (for spawned tasks to finish) at the end of a nursery scope. Catching KeyboardInterrupt from the spawns wasn't helpful so I eventually decided to catch it outside the nursery and then just use a new nursery to handle shutting down all the connections in parallel.

@oremanj
Copy link
Member

oremanj commented Mar 12, 2019

Closing this since I don't think it's actionable at this point. @merrellb, feel free to reopen if there's an issue you'd like us to address. :-)

@oremanj oremanj closed this as completed Mar 12, 2019
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

No branches or pull requests

3 participants