mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-23 09:51:28 +01:00
Cancel responses on startup
This commit is contained in:
@@ -600,6 +600,19 @@ pub async fn create_response(
|
||||
get_response(&id, pool).await
|
||||
}
|
||||
|
||||
pub async fn cancel_pending_responses(pool: &Pool<Sqlite>) -> Result<(), sqlx::Error> {
|
||||
sqlx::query!(
|
||||
r#"
|
||||
UPDATE http_responses
|
||||
SET (elapsed, status_reason) = (-1, 'Cancelled')
|
||||
WHERE elapsed = 0;
|
||||
"#,
|
||||
)
|
||||
.execute(pool)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn update_response_if_id(
|
||||
response: &HttpResponse,
|
||||
pool: &Pool<Sqlite>,
|
||||
|
||||
Reference in New Issue
Block a user