Skip to content

Commit

Permalink
refactor: removing transaction handling
Browse files Browse the repository at this point in the history
  • Loading branch information
BorisLord committed Dec 4, 2024
1 parent 63f2831 commit 092885e
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions api/src/db/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2864,20 +2864,16 @@ impl Database {
kind: DependencyKind,
name: &str,
) -> Result<usize> {
let mut tx = self.pool.begin().await?;

let total_unique_package_dependents = sqlx::query!(
r#"SELECT COUNT(DISTINCT (package_scope, package_name)) FROM package_version_dependencies
WHERE dependency_kind = $1 AND dependency_name = $2;"#,
kind as _,
name,
)
.map(|r| r.count.unwrap())
.fetch_one(&mut *tx)
.fetch_one(&self.pool)
.await?;

tx.commit().await?;

Ok(total_unique_package_dependents as usize)
}

Expand Down

0 comments on commit 092885e

Please sign in to comment.