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

Split run() into setup and execution #1

Open
WojciechMigda opened this issue Oct 24, 2019 · 1 comment
Open

Split run() into setup and execution #1

WojciechMigda opened this issue Oct 24, 2019 · 1 comment

Comments

@WojciechMigda
Copy link
Contributor

Hi,
would it be possible to split run() method into preparation part, which creates sending and receiving coroutines and the execution part?

Right now, with the code I am integrating your module into, I had to copy-paste some of the run() functionality into:

def ready(self, host, port, loop=None):
    self.loop = loop or asyncio.get_event_loop()
    self.sock.bind((host, port))
    self.connection_made()
    stask = self._send_periodically()
    rtask = self._recv_periodically()
    return stask, rtask

so that later I could schedule execution with some other coroutine using Nursery from aionursery. Otherwise, I was running into exceptions being thrown while my app was exiting.
Thanks.

@bashkirtsevich
Copy link
Member

Feel free to send a pull request.

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

2 participants