-
Notifications
You must be signed in to change notification settings - Fork 46
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
Implementation refactor for Client-based interface #286
Conversation
This fixes the case when EdgeDB client is global and used in an ``asyncio.run`` call, the client uses a wrong loop.
Before this fix, the client allows multiple concurrent first connections. This wasn't an issue because the _working_addr is always the same among the concurrent first connections. However, it was not clear which address shall win the race and be used for upcoming connections when multiple addresses are used in the future. After this fix, all concurrent first connection attempts will be serialized, the address from the first successful connection will be used for following connections. Concurrency will be resumed as soon as the address is found, including the previously-serialized pending "first" connections.
Switch to using a single ``_connect_args`` dict to store all connect arguments, which is also consistent with ``con_utils.parse_connect_arguments()``.
0efc2e4
to
93516b9
Compare
Also added blocking pool (single-connection only), and fixed all tests to use client instead of connection.
88fe5ac
to
d5133d1
Compare
Also close blocking client socket on disconnect, and fix tests
Also extracted most duplicate code, and dropped outdated code
In this case, concurrent close() and connect() are racing. If connect() wins, close() was releasing the connection by mistake.
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.
Impressive work, Fantix! A net reduction of ~700 lines in the implementation despite the addition of a thread-safe concurrent blocking pool. I especially like the cleanup in the transaction implementation.
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.
Epic work, Fantix. I think this is ready to land.
Review note: there is one merge commit "Partially revert ..." in this branch to reserve git history; use this link to see the merged diff.
edgedb.connect()
and replace with a single-connectionClient
_iter_coroutine()
on top level