Comments (14)
I've got an initial attempt in #37 that's most of the way there.
from bb8.
Alright, I'll take a look at where things stand but that's unlikely to happen before Sunday at the earliest.
I don't think futures 0.1->0.3 is going to be that painful.
from bb8.
https://github.com/sfackler/rust-postgres/tree/std-futures/tokio-postgres
from bb8.
Could we also change the interface a bit to the direction of how r2d2 works, could it be possible now with std::future
, async/await and Pin
?
So we could be able to use it in a more synchronous-looking manner:
impl AsyncConnector for MyTestPostgresConnector {
fn run(&self, query: String) -> FutureObj<'static, crate::Result<serde_json::Value>> {
let fut = async move {
let mut client = self.pool.get().await?;
let stmt = client.prepare(query.as_str()).await?;
let rows = client.query(&stmt, &[]).collect().await?;
Ok(rows.into_json()?)
};
FutureObj::new(Box::new(fut))
}
}
from bb8.
Any updates for this? In my app server grabbing the connection each request adds a lot of overhead. I'd like to use this with Rocket, but currently they're incompatible because async Rocket is already on std::future
.
from bb8.
Not really much we can do here until tokio-postgres at least supports these things, since we're heavily dependent on it.
from bb8.
What is tokio-postgres still missing? I've been using its std-futures branch without any real issues for a couple weeks now.
from bb8.
Maybe it's not missing anything in git, I haven't looked in a while. tokio-postgres doesn't really do releases unfortunately so it's hard to know when it's reached usable points.
from bb8.
Ah okay. Well I can give a bit of an endorsement here I think. I've been using the Rocket
futures branch and the tokio-postgres
futures branch in my project for the past month or so and haven't run into any issues yet.
I was talking to the Rocket developers just now and they're interested in using bb8 to implement an async connection pool for postgres in Rocket, but were just waiting on this crate to also update to std-futures. What do you think? :D
Unfortunately I have no idea what the effort required is to update from futures 0.1 to 0.3 since I'm still a Rust noob. Is it very hard?
from bb8.
What! That's amazing news! Thanks so much!
from bb8.
Hi @khuey I was wondering if you ever got a chance to check out tokio-postgres's futures branch and if it could work with bb8.
from bb8.
tokio-postgres v0.5.0-alpha.1 which uses std::futures::Future and async/await syntax is out.
from bb8.
async/await syntax stabilized in 1.39.
from bb8.
This is done.
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.