-
Notifications
You must be signed in to change notification settings - Fork 76
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
connect blocks #35
Comments
The ideal solution is to implement the postgres protocol using Crystal's IO classes (like Socket) which are non-blocking by default. It's a lot of work, but it's the best solution (many other languages implement it this way too, for example Go) |
Is there any workaround until that day comes? |
Currently, while postgres is working on the query, that is async. It's only while sending and receiving data that is sync due to libpq. There is no workaround for that. Going native does have both that upside, and would fix the linking problems (#13 and crystal-lang/crystal#1269). However we'd no longer get new authentication schemes for free (it's looking like SCRAM will make it in soon), and small nice things like the default socket location being known will be lost or have to be reimplemented. At least the protocol isn't too complicated, especially compared to others. |
The driver is now native |
I did not even install your driver, but looking at the code, it must be blocking.
The node guys went for a background thread solution, since libpg async methods block as well:
https://github.com/brianc/node-libpq
https://www.npmjs.com/package/pg-libpq
To be honest i came to your repo to find out how crystal handles async IO. Maybe there is no support yet, I do not know.
The text was updated successfully, but these errors were encountered: