Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,6 @@ pub fn try_rsgi_sync_short_circuit(
if !snapshot.request_middleware.is_empty() || !snapshot.response_middleware.is_empty() {
return Ok(None);
}
if method == "GET" && path == "/test_db" {
return Ok(None); // defer to async run_rsgi for the prototype
}
if (method == "GET" || method == "HEAD") && path == "/openapi.json" && snapshot.include_openapi
{
let _ = protocol_py.setattr(py, "__oxyroute_path_template__", "/openapi.json");
Expand Down Expand Up @@ -503,35 +500,6 @@ pub async fn run_rsgi(
}
return response::send_str(&protocol, 200, &doc, "application/json; charset=utf-8").await;
}
// Prototype: Issue 55 (sqlx integration benchmark path)
if method == "GET" && path == "/test_db" {
let _ =
Python::with_gil(|py| protocol.setattr(py, "__oxyroute_path_template__", "/test_db"));
if let Some(pool) = snapshot.db_pool.as_ref() {
use sqlx::Row;
match sqlx::query("SELECT 1 as num").fetch_one(pool).await {
Ok(row) => {
let num: i32 = row.get("num");
return response::send_str(
&protocol,
200,
&format!(r#"{{"num":{num}}}"#),
"application/json; charset=utf-8",
)
.await;
}
Err(e) => {
return response::send_str(
&protocol,
500,
&format!(r#"{{"error":"{e}"}}"#),
"application/json; charset=utf-8",
)
.await;
}
}
}
}
for mw in snapshot.request_middleware.iter() {
let out: Py<PyAny> = match Python::with_gil(|py| {
let f = mw.bind(py);
Expand Down
3 changes: 0 additions & 3 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ impl AppState {
response_middleware: Arc::clone(&response_middleware),
exception_handlers: Arc::clone(&exception_handlers),
include_openapi: true,
db_pool: None,
});
Self {
routes,
Expand Down Expand Up @@ -248,7 +247,6 @@ impl AppState {
response_middleware: Arc::clone(&self.response_middleware),
exception_handlers: Arc::clone(&self.exception_handlers),
include_openapi: self.include_openapi,
db_pool: self.db_pool.clone(),
});
});
}
Expand Down Expand Up @@ -290,7 +288,6 @@ pub struct FrozenState {
pub response_middleware: Arc<Vec<Py<PyAny>>>,
pub exception_handlers: ExceptionHandlerList,
pub include_openapi: bool,
pub db_pool: Option<sqlx::PgPool>,
}

pub type HotSnapshot = Arc<FrozenState>;
Expand Down
Loading