Skip to content

Commit

Permalink
fix(backend): lock rows that are being streamed to pipeline (#3073)
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliusroemer authored Dec 5, 2024
1 parent 5c6c7ae commit 9d6a506
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import org.jetbrains.exposed.sql.stringLiteral
import org.jetbrains.exposed.sql.stringParam
import org.jetbrains.exposed.sql.transactions.transaction
import org.jetbrains.exposed.sql.update
import org.jetbrains.exposed.sql.vendors.ForUpdateOption.PostgreSQL.ForUpdate
import org.jetbrains.exposed.sql.vendors.ForUpdateOption.PostgreSQL.MODE
import org.loculus.backend.api.AccessionVersion
import org.loculus.backend.api.AccessionVersionInterface
import org.loculus.backend.api.AccessionVersionOriginalMetadata
Expand Down Expand Up @@ -163,6 +165,7 @@ class SubmissionDatabaseService(
}
.orderBy(table.accessionColumn)
.limit(numberOfSequenceEntries)
.forUpdate(ForUpdate(mode = MODE.SKIP_LOCKED))
.fetchSize(streamBatchSize)
.asSequence()
.chunked(streamBatchSize)
Expand Down

0 comments on commit 9d6a506

Please sign in to comment.