Skip to content

Commit

Permalink
Merge pull request #1260 from modelix/fix/use-do-not-use-store-in-req…
Browse files Browse the repository at this point in the history
…uest-thread

fix(model-server): do not put objects into store in request thread
  • Loading branch information
odzhychko authored Dec 18, 2024
2 parents 3e747d1 + 0c69ab2 commit 260e367
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,11 @@ class ModelReplicationServer(
val branchRef = repositoryId(repository).getBranchReference(branch)
val deltaFromClient = call.receive<VersionDelta>()
deltaFromClient.checkObjectHashes()
@OptIn(RequiresTransaction::class) // no transactions required for immutable store
repositoriesManager.getStoreClient(RepositoryId(repository), true).putAll(deltaFromClient.getAllObjects())
val objectsFromClient = deltaFromClient.getAllObjects()
withContext(Dispatchers.IO) {
@OptIn(RequiresTransaction::class) // no transactions required for immutable store
repositoriesManager.getStoreClient(RepositoryId(repository), true).putAll(objectsFromClient)
}
@OptIn(RequiresTransaction::class)
val mergedHash = runWrite {
repositoriesManager.mergeChanges(branchRef, deltaFromClient.versionHash)
Expand Down

0 comments on commit 260e367

Please sign in to comment.