Skip to content

Open source AI coding agent. Designed for large projects and real world tasks.

fix deadlock issue... release local lock before db lock when unlocking

Dane Schneider84805ace2268
diff --git a/app/server/db/locks.go b/app/server/db/locks.go
index 17aa7295..3f67982b 100644
--- a/app/server/db/locks.go
+++ b/app/server/db/locks.go
@@ -317,9 +317,6 @@ func DeleteRepoLock(id, planId string) error {
return fmt.Errorf("error getting lock info: %v", err)
}
- // Do the DB remove first
- dbErr := deleteRepoLockDB(id, planId, 0)
-
branch := ""
if maybeBranch != nil {
branch = *maybeBranch
@@ -328,6 +325,9 @@ func DeleteRepoLock(id, planId string) error {
// Then free local concurrency
releaseLocalLock(planId, branch, scope)
+ // Do the DB remove first
+ dbErr := deleteRepoLockDB(id, planId, 0)
+
return dbErr
}