Compare commits

...

4 Commits

Author SHA1 Message Date
leif stawnyczy 5e13c2e41e adding the code 2024-09-27 13:43:06 -04:00
leif stawnyczy f33999efef turning off checkstyle 2024-09-27 13:16:33 -04:00
leif stawnyczy 5940839f96 checkstyle fixes 2024-09-27 11:52:42 -04:00
leif stawnyczy f83663e43a checkstyle fixes 2024-09-27 09:52:54 -04:00
5 changed files with 23 additions and 6 deletions

View File

@ -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>

View File

@ -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;

View File

@ -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());
} }
} }

View File

@ -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(

View File

@ -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;
} }