-
Notifications
You must be signed in to change notification settings - Fork 19
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
[WIP] Trio based implementation of the Endpoint API #56
[WIP] Trio based implementation of the Endpoint API #56
Conversation
pytest-dev/pytest-asyncio#125 if accepted and released would allow us to condense the test runs back down. |
347b742
to
5cf6354
Compare
lahja/_utils.py
Outdated
import time | ||
|
||
|
||
async def wait_for_path(path: pathlib.Path, timeout: int=2) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: I can extract this change out of this PR
from lahja.trio.endpoint import TrioEndpoint | ||
|
||
|
||
class BaseBackend(ABC): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: extract this into a standalone PR to reduce scope of this PR
lahja/trio/endpoint.py
Outdated
msg_data = pickle.dumps(message) | ||
size = len(msg_data) | ||
await self._socket.send_all(size.to_bytes(4, 'little')) | ||
await self._socket.send_all(msg_data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably cheaper to combine these into a single send over the socket?
lahja/trio/endpoint.py
Outdated
if msg_size_data == b'': | ||
# probably in the process of being cancelled... | ||
await trio.hazmat.checkpoint() | ||
raise EOFError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should probably be converted to an internal lahja
exception.
lahja/trio/endpoint.py
Outdated
raise Exception("TODO: stream closed") | ||
if len(msg_data) != msg_size: | ||
# probably in the process of being cancelled... | ||
await trio.hazmat.checkpoint() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: I think this can be removed. as well as the other ones.
0656050
to
157f41b
Compare
dde8b75
to
75e1d3e
Compare
75e1d3e
to
9496b5e
Compare
9496b5e
to
10d26b9
Compare
blocked by #88
What was wrong?
WIP
Ugly things:
pytest-asyncio
doesn't play nice in the test suite so I ended up having to segregate them.How was it fixed?
Summary of approach.
Cute Animal Picture