Skip to content

Commit 4a6f8a0

Browse files
committed
store: Asyncify advisory_lock::with_migration_lock.execute
1 parent 75c0b0b commit 4a6f8a0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

store/postgres/src/advisory_lock.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ where
8484
F: FnOnce(&mut PgConnection) -> Fut,
8585
Fut: std::future::Future<Output = Result<R, StoreError>>,
8686
{
87-
fn execute(conn: &mut PgConnection, query: &str, msg: &str) -> Result<(), StoreError> {
87+
async fn execute(conn: &mut PgConnection, query: &str, msg: &str) -> Result<(), StoreError> {
8888
sql_query(query).execute(conn).map(|_| ()).map_err(|e| {
8989
StoreError::from_diesel_error(&e)
9090
.unwrap_or_else(|| StoreError::Unknown(anyhow::anyhow!("{}: {}", msg, e)))
@@ -94,9 +94,9 @@ where
9494
const LOCK: &str = "select pg_advisory_lock(1)";
9595
const UNLOCK: &str = "select pg_advisory_unlock(1)";
9696

97-
execute(conn, LOCK, "failed to acquire migration lock")?;
97+
execute(conn, LOCK, "failed to acquire migration lock").await?;
9898
let res = f(conn).await;
99-
execute(conn, UNLOCK, "failed to release migration lock")?;
99+
execute(conn, UNLOCK, "failed to release migration lock").await?;
100100
res
101101
}
102102

0 commit comments

Comments
 (0)