Merge branch 'master' into fix-intermittent-in-tests

This commit is contained in:
Tadgh 2021-08-31 14:22:22 -04:00 committed by GitHub
commit 765b18013c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 14 deletions

View File

@ -22,6 +22,7 @@ package ca.uhn.fhir.jpa.batch;
import ca.uhn.fhir.jpa.batch.processor.GoldenResourceAnnotatingProcessor;
import ca.uhn.fhir.jpa.batch.processor.PidToIBaseResourceProcessor;
import ca.uhn.fhir.jpa.reindex.job.ReindexWriter;
import org.springframework.batch.core.configuration.annotation.StepScope;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -41,4 +42,10 @@ public class CommonBatchJobConfig {
return new GoldenResourceAnnotatingProcessor();
}
@Bean
@StepScope
public ReindexWriter reindexWriter() {
return new ReindexWriter();
}
}

View File

@ -49,6 +49,8 @@ public class ReindexEverythingJobConfig {
private StepBuilderFactory myStepBuilderFactory;
@Autowired
private JobBuilderFactory myJobBuilderFactory;
@Autowired
private ReindexWriter myReindexWriter;
@Bean(name = REINDEX_EVERYTHING_JOB_NAME)
@Lazy
@ -63,7 +65,7 @@ public class ReindexEverythingJobConfig {
return myStepBuilderFactory.get(REINDEX_EVERYTHING_STEP_NAME)
.<List<Long>, List<Long>>chunk(1)
.reader(cronologicalBatchAllResourcePidReader())
.writer(reindexWriter())
.writer(myReindexWriter)
.listener(reindexEverythingPidCountRecorderListener())
.listener(reindexEverythingPromotionListener())
.build();
@ -75,12 +77,6 @@ public class ReindexEverythingJobConfig {
return new CronologicalBatchAllResourcePidReader();
}
@Bean
@StepScope
public ReindexWriter reindexWriter() {
return new ReindexWriter();
}
@Bean
@StepScope
public PidReaderCounterListener reindexEverythingPidCountRecorderListener() {

View File

@ -51,6 +51,8 @@ public class ReindexJobConfig extends MultiUrlProcessorJobConfig {
private StepBuilderFactory myStepBuilderFactory;
@Autowired
private JobBuilderFactory myJobBuilderFactory;
@Autowired
private ReindexWriter myReindexWriter;
@Bean(name = REINDEX_JOB_NAME)
@Lazy
@ -66,18 +68,12 @@ public class ReindexJobConfig extends MultiUrlProcessorJobConfig {
return myStepBuilderFactory.get(REINDEX_URL_LIST_STEP_NAME)
.<List<Long>, List<Long>>chunk(1)
.reader(reverseCronologicalBatchResourcePidReader())
.writer(reindexWriter())
.writer(myReindexWriter)
.listener(pidCountRecorderListener())
.listener(reindexPromotionListener())
.build();
}
@Bean
@StepScope
public ReindexWriter reindexWriter() {
return new ReindexWriter();
}
@Bean
public ExecutionContextPromotionListener reindexPromotionListener() {
ExecutionContextPromotionListener listener = new ExecutionContextPromotionListener();