Skip to content

Commit

Permalink
fix: Locking single job for project
Browse files Browse the repository at this point in the history
  • Loading branch information
JanCizmar committed Jul 28, 2023
1 parent 9be6b4d commit 40f9d51
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ abstract class AbstractBatchJobsGeneralTest : AbstractSpringTest(), Logging {
@Test
fun `it locks the single job for project`() {
logger.info("Running test: it locks the single job for project")
currentDateProvider.forcedDate = null
batchJobConcurrentLauncher.pause = true

val job1 = runChunkedJob(20)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,13 @@ class BatchJobConcurrentLauncher(
)

// we haven't publish consuming, so we can add it only to the local queue
batchJobChunkExecutionQueue.addItemsToLocalQueue(listOf(executionItem))
batchJobChunkExecutionQueue.addItemsToLocalQueue(
listOf(
executionItem.also {
it.executeAfter = currentDateProvider.date.time + 1000
}
)
)
return
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package io.tolgee.batch
data class ExecutionQueueItem(
val chunkExecutionId: Long,
val jobId: Long,
val executeAfter: Long?
var executeAfter: Long?
)

0 comments on commit 40f9d51

Please sign in to comment.