@@ -31,7 +31,11 @@ struct Scope {
3131impl Scope {
3232 /// Try to lock the deployment in this scope with the given id. Return
3333 /// `true` if we got the lock, and `false` if it is already locked.
34- fn try_lock ( & self , conn : & mut PgConnection , id : DeploymentId ) -> Result < bool , StoreError > {
34+ async fn try_lock (
35+ & self ,
36+ conn : & mut PgConnection ,
37+ id : DeploymentId ,
38+ ) -> Result < bool , StoreError > {
3539 #[ derive( QueryableByName ) ]
3640 struct Locked {
3741 #[ diesel( sql_type = Bool ) ]
@@ -111,11 +115,11 @@ pub(crate) fn unlock_copying(conn: &mut PgConnection, dst: &Site) -> Result<(),
111115/// simultaneously. Return `true` if we got the lock, and `false` if we did
112116/// not. You don't want to use this directly. Instead, use
113117/// `deployment::with_lock`
114- pub ( crate ) fn lock_deployment_session (
118+ pub ( crate ) async fn lock_deployment_session (
115119 conn : & mut PgConnection ,
116120 site : & Site ,
117121) -> Result < bool , StoreError > {
118- WRITE . try_lock ( conn, site. id )
122+ WRITE . try_lock ( conn, site. id ) . await
119123}
120124
121125/// Release the lock acquired with `lock_deployment_session`.
@@ -128,8 +132,11 @@ pub(crate) fn unlock_deployment_session(
128132
129133/// Try to take the lock used to prevent two prune operations from running at the
130134/// same time. Return `true` if we got the lock, and `false` otherwise.
131- pub ( crate ) fn try_lock_pruning ( conn : & mut PgConnection , site : & Site ) -> Result < bool , StoreError > {
132- PRUNE . try_lock ( conn, site. id )
135+ pub ( crate ) async fn try_lock_pruning (
136+ conn : & mut PgConnection ,
137+ site : & Site ,
138+ ) -> Result < bool , StoreError > {
139+ PRUNE . try_lock ( conn, site. id ) . await
133140}
134141
135142pub ( crate ) fn unlock_pruning ( conn : & mut PgConnection , site : & Site ) -> Result < ( ) , StoreError > {
0 commit comments