Keep Status ActiveError on Job Run (#17515)

This commit is contained in:
Mohit Yadav 2024-08-21 08:51:13 +05:30 committed by GitHub
parent d59473f718
commit dc10b38b77
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -142,8 +142,6 @@ public class SearchIndexApp extends AbstractNativeApplication {
// Run ReIndexing
performReindex(jobExecutionContext);
// Mark Job as Completed
updateJobStatus();
} catch (Exception ex) {
IndexingError indexingError =
new IndexingError()
@ -153,7 +151,7 @@ public class SearchIndexApp extends AbstractNativeApplication {
"Reindexing Job Has Encountered an Exception. %n Job Data: %s, %n Stack : %s ",
jobData.toString(), ExceptionUtils.getStackTrace(ex)));
LOG.error(indexingError.getMessage());
jobData.setStatus(EventPublisherJob.Status.FAILED);
jobData.setStatus(EventPublisherJob.Status.ACTIVE_ERROR);
jobData.setFailure(indexingError);
} finally {
// Send update
@ -257,7 +255,7 @@ public class SearchIndexApp extends AbstractNativeApplication {
}
} catch (SearchIndexException rx) {
jobData.setStatus(EventPublisherJob.Status.FAILED);
jobData.setStatus(EventPublisherJob.Status.ACTIVE_ERROR);
jobData.setFailure(rx.getIndexingError());
paginatedSource.updateStats(
rx.getIndexingError().getSuccessCount(), rx.getIndexingError().getFailedCount());
@ -396,18 +394,6 @@ public class SearchIndexApp extends AbstractNativeApplication {
searchRepository.createIndex(indexType);
}
private void updateJobStatus() {
if (stopped) {
jobData.setStatus(EventPublisherJob.Status.STOPPED);
} else {
if (jobData.getFailure() != null) {
jobData.setStatus(EventPublisherJob.Status.FAILED);
} else {
jobData.setStatus(EventPublisherJob.Status.COMPLETED);
}
}
}
public void stopJob() {
stopped = true;
}