Rework escape hatch to error

This commit is contained in:
Tadgh 2020-08-01 13:08:29 -07:00
parent 0d90bbcc9c
commit 3068fe8c1a
2 changed files with 6 additions and 4 deletions

View File

@ -31,7 +31,6 @@ import ca.uhn.fhir.jpa.empi.svc.EmpiChannelSubmitterSvcImpl;
import ca.uhn.fhir.jpa.empi.svc.EmpiPersonDeletingSvc; import ca.uhn.fhir.jpa.empi.svc.EmpiPersonDeletingSvc;
import ca.uhn.fhir.jpa.empi.svc.EmpiSearchParamSvc; import ca.uhn.fhir.jpa.empi.svc.EmpiSearchParamSvc;
import ca.uhn.fhir.jpa.subscription.channel.api.IChannelFactory; import ca.uhn.fhir.jpa.subscription.channel.api.IChannelFactory;
import ca.uhn.fhir.jpa.subscription.channel.subscription.IChannelNamer;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
@ -66,8 +65,8 @@ public class EmpiSubmitterConfig {
@Bean @Bean
@Lazy @Lazy
IEmpiChannelSubmitterSvc empiChannelSubmitterSvc(IChannelNamer theChannelNamer, FhirContext theFhirContext, IChannelFactory theChannelFactory) { IEmpiChannelSubmitterSvc empiChannelSubmitterSvc(FhirContext theFhirContext, IChannelFactory theChannelFactory) {
return new EmpiChannelSubmitterSvcImpl(theChannelNamer, theFhirContext, theChannelFactory); return new EmpiChannelSubmitterSvcImpl(theFhirContext, theChannelFactory);
} }
@Bean @Bean

View File

@ -65,9 +65,12 @@ public class EmpiPersonDeletingSvc {
IFhirResourceDao personDao = myDaoRegistry.getResourceDao("Person"); IFhirResourceDao personDao = myDaoRegistry.getResourceDao("Person");
int batchCount = 0; int batchCount = 0;
while (!deleteConflictList.isEmpty() && batchCount < MAXIMUM_DELETE_ATTEMPTS) { while (!deleteConflictList.isEmpty()) {
deleteConflictBatch(deleteConflictList, personDao); deleteConflictBatch(deleteConflictList, personDao);
batchCount += 1; batchCount += 1;
if (batchCount > MAXIMUM_DELETE_ATTEMPTS) {
throw new IllegalStateException("Person deletion seems to have entered an infinite loop. Aborting");
}
} }
} }