Compare commits
4 Commits
d677d83cce
...
5e13c2e41e
Author | SHA1 | Date |
---|---|---|
leif stawnyczy | 5e13c2e41e | |
leif stawnyczy | f33999efef | |
leif stawnyczy | 5940839f96 | |
leif stawnyczy | f83663e43a |
|
@ -64,4 +64,12 @@
|
||||||
<property name="format" value="^(Base|Abstract).+$"/>
|
<property name="format" value="^(Base|Abstract).+$"/>
|
||||||
</module>
|
</module>
|
||||||
</module>
|
</module>
|
||||||
|
|
||||||
|
<!-- for suppression of rules; to use, surround code to exclude with comments: -->
|
||||||
|
<!-- CHECKSTYLE.OFF RuleToDisable AND CHECKSTYLE.ON RuleToDisable -->
|
||||||
|
<module name="SuppressWithPlainTextCommentFilter">
|
||||||
|
<property name="offCommentFormat" value="CHECKSTYLE.OFF\: ([\w\|]+)" />
|
||||||
|
<property name="onCommentFormat" value="CHECKSTYLE.ON\: ([\w\|]+)" />
|
||||||
|
</module>
|
||||||
|
|
||||||
</module>
|
</module>
|
||||||
|
|
|
@ -12,7 +12,7 @@ import ca.uhn.fhir.rest.api.server.SystemRequestDetails;
|
||||||
import ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId;
|
import ca.uhn.fhir.rest.api.server.storage.IResourcePersistentId;
|
||||||
import ca.uhn.fhir.rest.api.server.storage.TransactionDetails;
|
import ca.uhn.fhir.rest.api.server.storage.TransactionDetails;
|
||||||
|
|
||||||
public class BaseReindexStep {
|
public abstract class BaseReindexStep {
|
||||||
|
|
||||||
public static final int REINDEX_MAX_RETRIES = 10;
|
public static final int REINDEX_MAX_RETRIES = 10;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import ca.uhn.fhir.batch2.api.StepExecutionDetails;
|
||||||
import ca.uhn.fhir.batch2.api.VoidModel;
|
import ca.uhn.fhir.batch2.api.VoidModel;
|
||||||
import ca.uhn.fhir.batch2.jobs.reindex.models.ReindexResults;
|
import ca.uhn.fhir.batch2.jobs.reindex.models.ReindexResults;
|
||||||
import ca.uhn.fhir.batch2.jobs.reindex.svcs.ReindexJobService;
|
import ca.uhn.fhir.batch2.jobs.reindex.svcs.ReindexJobService;
|
||||||
|
import ca.uhn.fhir.i18n.Msg;
|
||||||
import jakarta.annotation.Nonnull;
|
import jakarta.annotation.Nonnull;
|
||||||
|
|
||||||
public class CheckPendingReindexWorkStep implements IJobStepWorker<ReindexJobParameters, ReindexResults, VoidModel> {
|
public class CheckPendingReindexWorkStep implements IJobStepWorker<ReindexJobParameters, ReindexResults, VoidModel> {
|
||||||
|
@ -30,8 +31,7 @@ public class CheckPendingReindexWorkStep implements IJobStepWorker<ReindexJobPar
|
||||||
|
|
||||||
if (!results.getResourceToHasWorkToComplete().isEmpty()) {
|
if (!results.getResourceToHasWorkToComplete().isEmpty()) {
|
||||||
if (myReindexJobService.anyResourceHasPendingReindexWork(results.getResourceToHasWorkToComplete())) {
|
if (myReindexJobService.anyResourceHasPendingReindexWork(results.getResourceToHasWorkToComplete())) {
|
||||||
// give time for reindex work to complete
|
throw new RetryChunkLaterException(Msg.code(2553), ReindexUtils.getRetryLaterDelay());
|
||||||
throw new RetryChunkLaterException(ReindexUtils.getRetryLaterDelay());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import ca.uhn.fhir.batch2.api.StepExecutionDetails;
|
||||||
import ca.uhn.fhir.batch2.jobs.chunk.ResourceIdListWorkChunkJson;
|
import ca.uhn.fhir.batch2.jobs.chunk.ResourceIdListWorkChunkJson;
|
||||||
import ca.uhn.fhir.batch2.jobs.reindex.models.ReindexResults;
|
import ca.uhn.fhir.batch2.jobs.reindex.models.ReindexResults;
|
||||||
import ca.uhn.fhir.batch2.jobs.reindex.svcs.ReindexJobService;
|
import ca.uhn.fhir.batch2.jobs.reindex.svcs.ReindexJobService;
|
||||||
|
import ca.uhn.fhir.i18n.Msg;
|
||||||
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||||
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
|
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
|
||||||
import ca.uhn.fhir.jpa.api.svc.IIdHelperService;
|
import ca.uhn.fhir.jpa.api.svc.IIdHelperService;
|
||||||
|
@ -53,7 +54,8 @@ public class ReindexStepV2 extends BaseReindexStep
|
||||||
resourceTypesToCheckFlag.put(id.getResourceType(), true);
|
resourceTypesToCheckFlag.put(id.getResourceType(), true);
|
||||||
});
|
});
|
||||||
if (myReindexJobService.anyResourceHasPendingReindexWork(resourceTypesToCheckFlag)) {
|
if (myReindexJobService.anyResourceHasPendingReindexWork(resourceTypesToCheckFlag)) {
|
||||||
throw new RetryChunkLaterException(ReindexUtils.getRetryLaterDelay());
|
|
||||||
|
throw new RetryChunkLaterException(Msg.code(2552), ReindexUtils.getRetryLaterDelay());
|
||||||
}
|
}
|
||||||
|
|
||||||
ReindexResults results = doReindex(
|
ReindexResults results = doReindex(
|
||||||
|
|
|
@ -38,11 +38,18 @@ public class RetryChunkLaterException extends RuntimeException {
|
||||||
private final Duration myNextPollDuration;
|
private final Duration myNextPollDuration;
|
||||||
|
|
||||||
public RetryChunkLaterException() {
|
public RetryChunkLaterException() {
|
||||||
this(ONE_MINUTE);
|
this("", ONE_MINUTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For HAPI exceptions, use {@link RetryChunkLaterException#RetryChunkLaterException(String, Duration)}
|
||||||
|
*/
|
||||||
public RetryChunkLaterException(Duration theDuration) {
|
public RetryChunkLaterException(Duration theDuration) {
|
||||||
super();
|
this("", theDuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RetryChunkLaterException(String theCode, Duration theDuration) {
|
||||||
|
super(theCode);
|
||||||
this.myNextPollDuration = theDuration;
|
this.myNextPollDuration = theDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue