Skip to content

Commit 57330d8

Browse files
fix: invalid error code on locked resource
Return aborted rather than already exists... Signed-off-by: Tiago Castro <tiagolobocastro@gmail.com>
1 parent 5b36521 commit 57330d8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

io-engine/src/grpc/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,14 @@ pub async fn acquire_subsystem_lock<'a>(
202202
if let Some(resource) = resource {
203203
match subsystem.lock_resource(resource.to_string(), None, true).await {
204204
Some(lock_guard) => Ok(lock_guard),
205-
None => Err(Status::already_exists(format!(
205+
None => Err(Status::aborted(format!(
206206
"Failed to acquire lock for the resource: {resource}, lock already held"
207207
))),
208208
}
209209
} else {
210210
match subsystem.lock(None, true).await {
211211
Some(lock_guard) => Ok(lock_guard),
212-
None => Err(Status::already_exists(format!(
212+
None => Err(Status::aborted(format!(
213213
"Failed to acquire subsystem lock: {subsystem:?}, lock already held",
214214
))),
215215
}

0 commit comments

Comments
 (0)