mirror of
https://github.com/modrinth/code.git
synced 2026-09-04 22:10:15 +00:00
Add SQLx operation tracing (#5223)
* wip: vendor sqlx-tracing * (compiles) standardize pg types used * more standardization * general log message improvements * wip: improve sqlx-tracing architecture * unify sqlx::Executor type * wip: try fix sqlx tracing * wip: sqlx-tracing compiles * so close * it compiles * fix ci
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use super::ApiError;
|
||||
use crate::auth::get_user_from_headers;
|
||||
use crate::database;
|
||||
use crate::database::PgPool;
|
||||
use crate::database::models::DBModerationLock;
|
||||
use crate::database::redis::RedisPool;
|
||||
use crate::models::ids::OrganizationId;
|
||||
@@ -14,7 +15,6 @@ use ariadne::ids::{UserId, random_base62};
|
||||
use chrono::{DateTime, Utc};
|
||||
use ownership::get_projects_ownership;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::PgPool;
|
||||
use std::collections::HashMap;
|
||||
|
||||
mod ownership;
|
||||
@@ -462,7 +462,7 @@ async fn set_project_meta(
|
||||
.bind(&links[..])
|
||||
.bind(&proofs[..])
|
||||
.bind(&flame_ids[..])
|
||||
.execute(&mut *transaction)
|
||||
.execute(&mut transaction)
|
||||
.await?;
|
||||
|
||||
sqlx::query(
|
||||
@@ -475,7 +475,7 @@ async fn set_project_meta(
|
||||
)
|
||||
.bind(&file_hashes[..])
|
||||
.bind(&ids[..])
|
||||
.execute(&mut *transaction)
|
||||
.execute(&mut transaction)
|
||||
.await?;
|
||||
|
||||
transaction.commit().await?;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use crate::database::PgPool;
|
||||
use crate::database::models::{DBOrganization, DBTeamId, DBTeamMember, DBUser};
|
||||
use crate::database::redis::RedisPool;
|
||||
use crate::models::ids::OrganizationId;
|
||||
@@ -5,7 +6,6 @@ use crate::routes::internal::moderation::Ownership;
|
||||
use crate::util::error::Context;
|
||||
use ariadne::ids::UserId;
|
||||
use eyre::eyre;
|
||||
use sqlx::PgPool;
|
||||
|
||||
/// Fetches ownership information for multiple projects efficiently
|
||||
pub async fn get_projects_ownership(
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use std::{collections::HashMap, fmt};
|
||||
|
||||
use crate::database::PgPool;
|
||||
use actix_web::{HttpRequest, get, patch, post, put, web};
|
||||
use chrono::{DateTime, Utc};
|
||||
use itertools::Itertools;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::PgPool;
|
||||
|
||||
use super::ownership::get_projects_ownership;
|
||||
use crate::{
|
||||
@@ -986,7 +986,7 @@ async fn submit_report(
|
||||
"#,
|
||||
project_id as _,
|
||||
)
|
||||
.fetch_all(&mut *txn)
|
||||
.fetch_all(&mut txn)
|
||||
.await
|
||||
.wrap_internal_err("failed to fetch pending issues")?;
|
||||
|
||||
@@ -1016,7 +1016,7 @@ async fn submit_report(
|
||||
",
|
||||
project_id as _,
|
||||
)
|
||||
.execute(&mut *txn)
|
||||
.execute(&mut txn)
|
||||
.await
|
||||
.wrap_internal_err("failed to delete dummy issue")?;
|
||||
|
||||
@@ -1029,7 +1029,7 @@ async fn submit_report(
|
||||
"#,
|
||||
project_id as _,
|
||||
)
|
||||
.fetch_one(&mut *txn)
|
||||
.fetch_one(&mut txn)
|
||||
.await
|
||||
.wrap_internal_err("failed to update reports")?;
|
||||
|
||||
@@ -1087,7 +1087,7 @@ async fn submit_report(
|
||||
ProjectStatus::Rejected.as_str(),
|
||||
project_id as _,
|
||||
)
|
||||
.fetch_one(&mut *txn)
|
||||
.fetch_one(&mut txn)
|
||||
.await
|
||||
.wrap_internal_err("failed to mark project as rejected")?;
|
||||
|
||||
@@ -1182,7 +1182,7 @@ async fn update_issue_detail(
|
||||
status as _,
|
||||
issue_detail_id as _,
|
||||
)
|
||||
.execute(&mut *txn)
|
||||
.execute(&mut txn)
|
||||
.await
|
||||
.wrap_internal_err("failed to update issue detail")?;
|
||||
if results.rows_affected() == 0 {
|
||||
@@ -1240,7 +1240,7 @@ async fn add_report(
|
||||
"#,
|
||||
DBFileId::from(file_id) as _,
|
||||
)
|
||||
.fetch_one(&mut *txn)
|
||||
.fetch_one(&mut txn)
|
||||
.await
|
||||
.wrap_internal_err("failed to fetch file")?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user