Skip to content

Commit

Permalink
Revert "#122 | Replace the ErrorRecordLog every time to ensure that t…
Browse files Browse the repository at this point in the history
…he latest entry with most recent error loggedAt dateTime is retained in the system"

This reverts commit aca8b5b.
  • Loading branch information
himeshr committed Apr 11, 2024
1 parent aca8b5b commit 40674aa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,16 @@ private List<ErrorType> getErrorTypeBy(ErrorTypeFollowUpStep followUpStep) {
private ErrorRecord saveGoonjError(String uuid, String goonjErrorTypeName, GoonjEntityType goonjEntityType, String errorMsg) {
ErrorRecord errorRecord = errorRecordRepository.findByIntegratingEntityTypeAndEntityId(goonjEntityType.name(), uuid);
ErrorType errorType = getErrorType(goonjErrorTypeName);
if (errorRecord != null) {
if(errorRecord.hasThisAsLastErrorTypeAndErrorMessage(errorType, errorMsg)) {
logger.info(String.format("Same error as the last processing for entity uuid %s, and type %s", uuid, goonjEntityType));
} else {
logger.info(String.format("New error for entity uuid %s, and type %s", uuid, goonjEntityType));
if (errorRecord != null && errorRecord.hasThisAsLastErrorTypeAndErrorMessage(errorType, errorMsg)) {
logger.info(String.format("Same error as the last processing for entity uuid %s, and type %s", uuid, goonjEntityType));
if (!errorRecord.isProcessingDisabled()) {
errorRecord.setProcessingDisabled(true);
errorRecordRepository.save(errorRecord);
}
errorRecord.addErrorLog(errorType, errorMsg);
} else if (errorRecord != null && !errorRecord.hasThisAsLastErrorTypeAndErrorMessage(errorType, errorMsg)) {
logger.info(String.format("New error for entity uuid %s, and type %s", uuid, goonjEntityType));
errorRecord.addErrorLog(errorType, errorMsg);
errorRecordRepository.save(errorRecord);
} else {
errorRecord = new ErrorRecord();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,8 @@ public void addErrorLog(ErrorType errorType, String errorMsg) {
errorRecordLog.setErrorType(errorType);
errorRecordLog.setErrorMsg(errorMsg);
errorRecordLog.setLoggedAt(new Date());
errorRecordLog.setErrorRecord(this);
replaceOrAddErrorRecordLog(errorRecordLog);
}

private void replaceOrAddErrorRecordLog(ErrorRecordLog errorRecordLog) {
if(errorRecordLogs.contains(errorRecordLog)) {
errorRecordLogs.remove(errorRecordLog);
}
errorRecordLogs.add(errorRecordLog);
errorRecordLog.setErrorRecord(this);
}

public boolean isProcessingDisabled() {
Expand Down

0 comments on commit 40674aa

Please sign in to comment.