Browse Source

arc for dbpool

pull/5037/head
Dmitry Ulyanov 7 months ago
parent
commit
74273e57b8
  1. 4
      src/db/mod.rs

4
src/db/mod.rs

@ -417,8 +417,8 @@ impl<'r> FromRequest<'r> for DbConn {
type Error = ();
async fn from_request(request: &'r Request<'_>) -> Outcome<Self, Self::Error> {
match request.rocket().state::<DbPool>() {
Some(p) => match p.get().await {
match request.rocket().state::<Arc<Mutex<DbPool>>>() {
Some(p) => match p.lock().await.get().await {
Ok(dbconn) => Outcome::Success(dbconn),
_ => Outcome::Error((Status::ServiceUnavailable, ())),
},

Loading…
Cancel
Save