From 88a916ece55a5fbb5b2f396ffa0a256dbcb42ddc Mon Sep 17 00:00:00 2001 From: leif stawnyczy Date: Tue, 12 Mar 2024 10:25:58 -0400 Subject: [PATCH] review poitns finished --- .../java/ca/uhn/fhir/jpa/batch2/JpaJobPersistenceImpl.java | 4 +++- .../uhn/fhir/batch2/coordinator/JobCoordinatorImplTest.java | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch2/JpaJobPersistenceImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch2/JpaJobPersistenceImpl.java index 1e193019eb3..c7e018dfe29 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch2/JpaJobPersistenceImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/batch2/JpaJobPersistenceImpl.java @@ -297,7 +297,9 @@ public class JpaJobPersistenceImpl implements IJobPersistence { public void enqueueWorkChunkForProcessing(String theChunkId, Consumer theCallback) { int updated = myWorkChunkRepository.updateChunkStatus( theChunkId, WorkChunkStatusEnum.QUEUED, WorkChunkStatusEnum.READY); - theCallback.accept(updated); + if (updated == 1) { + theCallback.accept(updated); + } } @Override diff --git a/hapi-fhir-storage-batch2/src/test/java/ca/uhn/fhir/batch2/coordinator/JobCoordinatorImplTest.java b/hapi-fhir-storage-batch2/src/test/java/ca/uhn/fhir/batch2/coordinator/JobCoordinatorImplTest.java index a8763fb795e..c8b5a2390df 100644 --- a/hapi-fhir-storage-batch2/src/test/java/ca/uhn/fhir/batch2/coordinator/JobCoordinatorImplTest.java +++ b/hapi-fhir-storage-batch2/src/test/java/ca/uhn/fhir/batch2/coordinator/JobCoordinatorImplTest.java @@ -55,6 +55,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; @@ -476,6 +477,7 @@ public class JobCoordinatorImplTest extends BaseBatch2Test { assertSame(jobDefinition, myJobDefinitionCaptor.getValue()); assertEquals(startRequest.getParameters(), myParametersJsonCaptor.getValue()); + verify(myBatchJobSender, never()).sendWorkChannelMessage(any()); verifyNoMoreInteractions(myJobInstancePersister); verifyNoMoreInteractions(myStep1Worker); verifyNoMoreInteractions(myStep2Worker);