Skip to content

Commit

Permalink
fix(model-server): RepositoriesManager.getVersionHash wasn't atomic
Browse files Browse the repository at this point in the history
  • Loading branch information
slisson committed Feb 20, 2024
1 parent 22b4384 commit 10260f7
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,10 @@ class RepositoriesManager(val client: LocalModelClient) {
}

fun getVersionHash(branch: BranchReference): String? {
return store[branchKey(branch)]
?: store[legacyBranchKey(branch)]?.also { store.put(branchKey(branch), it, true) }
return store.runTransaction {
store[branchKey(branch)]
?: store[legacyBranchKey(branch)]?.also { store.put(branchKey(branch), it, true) }
}
}

private fun putVersionHash(branch: BranchReference, hash: String?) {
Expand Down

0 comments on commit 10260f7

Please sign in to comment.