Comments (6)
Ugh, that's kind of nasty. Maybe we should add a method onto PostgresConnectionManager
and give you a way to get that from the Pool
.
from bb8.
It seems like a weird API from tokio-postgres
. If Connection
is supposed to "generally be spawned off onto an executor", you have no way of getting notifications? @sfackler, is that true? Wouldn't it make more sense to expose some kind of query_raw()
like API from the Client
?
from bb8.
Ugh, that's kind of nasty. Maybe we should add a method onto
PostgresConnectionManager
and give you a way to get that from thePool
.
That could work. Although this is not a high-priority issue (at least not for me...). Since we are using a dedicated connection already, right now I just use tokio_postgres::connect
directly to get the underlying connection object, instead of through bb8.
It seems like a weird API from
tokio-postgres
. IfConnection
is supposed to "generally be spawned off onto an executor", you have no way of getting notifications? @sfackler, is that true? Wouldn't it make more sense to expose some kind ofquery_raw()
like API from theClient
?
There does seem to be some friction between bb8
's API and tokio_postgres
's notification API. Currently, you need to call poll_message
on the tokio_postgres::Connection
object to receive notifications. You can make this more ergonomic with futures::stream::poll_fn
which just turns the connection into a notification Stream
value.
from bb8.
It appears you have to drive the connection yourself if you want to get LISTEN
notifications. Ideally tokio-postgres would split those off into a separate Stream
for you ...
from bb8.
The general expectation is that if you want to forward notifications to a stream, you'd write that code and then spawn it off: https://github.com/sfackler/rust-postgres/blob/master/tokio-postgres/tests/test/main.rs#L616-L619
What would a query_raw function do?
from bb8.
Ah, that general expectation is actually reasonable. But it's different from what I read into the documentation for poll_message()
: "Applications that wish to examine those messages should use this method to drive the connection rather than its Future implementation.". I guess there's no simple way to get this for a Client
because there's potentially many Client
s.
Maybe link that example code from the poll_message()
docs?
from bb8.
Related Issues (20)
- Time taken to get a connection from bb8 redis pool is very high HOT 2
- Unable to use bb8-redis pool connection to execute `query_async` commands on redis HOT 3
- Why bb8-redis can't support redis features? HOT 3
- ACL support for redis HOT 2
- Error sink not called unless debugger is attached with breakpoints HOT 2
- Reentrant deadlock HOT 5
- Reaper default frequency conflicts with other settings
- Unable to connect to secure client using bb8-redis HOT 2
- TimedOut error when has_broken = true HOT 8
- add a tag for v0.8.1 HOT 2
- Expose internal connection type in some way HOT 2
- Support for pool creation without requiring initial connection HOT 2
- Unusually slow to give redis connections HOT 7
- Close pool and all connections? HOT 1
- Support for pool creation with concurrent connections creation HOT 5
- Attempt to subtract with overflow, new version 8.2 HOT 5
- Timeout Issue with bb8-redis 0.14.0 on GCP Memorystore Redis HOT 5
- Changelog HOT 1
- Remove async-trait in favor of impl trait and native async in impls HOT 6
- Support async behavior to determine if the connection is no longer usable in ManageConnection Trait HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bb8.