File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
misk-aws2-sqs/src/test/kotlin/misk/aws2/sqs/jobqueue Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -7,16 +7,17 @@ import misk.jobqueue.v2.JobStatus
77import misk.jobqueue.v2.SuspendingJobHandler
88import misk.logging.getLogger
99import java.util.concurrent.CountDownLatch
10+ import java.util.concurrent.CopyOnWriteArrayList
1011
1112@Singleton
1213class ExampleHandler @Inject constructor(): SuspendingJobHandler {
1314 internal val counter = CountDownLatch (3 )
14- internal val jobs = mutableListOf <Job >()
15+ internal val jobs = CopyOnWriteArrayList <Job >()
1516
1617 override suspend fun handleJob (job : Job ): JobStatus {
1718 logger.info { " Handling job $job , current counter $counter " }
18- counter.countDown()
19- jobs.add(job)
19+ jobs.add(job) // Add job to list first
20+ counter.countDown() // Then signal completion
2021 return JobStatus .OK
2122 }
2223
You can’t perform that action at this time.
0 commit comments