We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
The can rx message handler in class Notifier is creating tasks when runs in async mode and gets a coroutine callback.
class Notifier
python-can/can/notifier.py
Lines 143 to 148 in 5d62394
However the python docs is clear that the reference to the task needs to be kept to ensure its not garbage collected: https://docs.python.org/3/library/asyncio-task.html#asyncio.create_task
The fix should be fairly straight forward:
def _on_message_received(self, msg: Message) -> None: for callback in self.listeners: res = callback(msg) if res and self._loop and asyncio.iscoroutine(res): # Schedule coroutine # In __init__: self._tasks: set[asyncio.Task] = set() task = self._loop.create_task(res) self._tasks.add(task) task.add_done_callback(self._tasks.discard)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The can rx message handler in
class Notifier
is creating tasks when runs in async mode and gets a coroutine callback.python-can/can/notifier.py
Lines 143 to 148 in 5d62394
However the python docs is clear that the reference to the task needs to be kept to ensure its not garbage collected: https://docs.python.org/3/library/asyncio-task.html#asyncio.create_task
The fix should be fairly straight forward:
The text was updated successfully, but these errors were encountered: