Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5f2804e

Browse files
authoredOct 6, 2023
Remove context calls for create database (#713)
1 parent 9b61d01 commit 5f2804e

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed
 

‎sqld/src/hrana/http/stream.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,7 @@ pub async fn acquire<'srv, D: Connection>(
155155
stream
156156
}
157157
None => {
158-
let db = connection_maker
159-
.create()
160-
.await
161-
.context("Could not create a database connection")?;
158+
let db = connection_maker.create().await?;
162159

163160
let mut state = server.stream_state.lock();
164161
let stream = Box::new(Stream {

‎sqld/src/hrana/ws/session.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::collections::HashMap;
22
use std::sync::Arc;
33

4-
use anyhow::{anyhow, bail, Context as _, Result};
4+
use anyhow::{anyhow, bail, Result};
55
use futures::future::BoxFuture;
66
use tokio::sync::{mpsc, oneshot};
77

@@ -195,8 +195,7 @@ pub(super) async fn handle_request<F: MakeNamespace>(
195195
.with_authenticated(namespace, authenticated, |ns| ns.db.connection_maker())
196196
.await?
197197
.create()
198-
.await
199-
.context("Could not create a database connection")?;
198+
.await?;
200199
stream.db = Some(Arc::new(db));
201200
Ok(proto::Response::OpenStream(proto::OpenStreamResp {}))
202201
});

‎sqld/src/http/user/hrana_over_http_1.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,7 @@ where
106106
let req_body = serde_json::from_slice(&req_body)
107107
.map_err(|e| hrana::ProtocolError::JsonDeserialize { source: e })?;
108108

109-
let db = db_factory
110-
.create()
111-
.await
112-
.context("Could not create a database connection")?;
109+
let db = db_factory.create().await?;
113110
let resp_body = f(db, req_body).await?;
114111

115112
Ok(json_response(hyper::StatusCode::OK, &resp_body))

0 commit comments

Comments
 (0)
This repository has been archived.