Skip to content

Commit

Permalink
make document handling thread safe when requesting information.
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-saunders-cts committed Dec 9, 2024
1 parent b318812 commit 63bf637
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import uk.gov.hmcts.probate.model.ccd.raw.request.CaseDetails;
import uk.gov.service.notify.NotificationClientException;

import java.util.ArrayList;
import java.util.List;

import static uk.gov.hmcts.probate.model.State.CASE_STOPPED_REQUEST_INFORMATION;
Expand All @@ -18,18 +17,16 @@
public class InformationRequestCorrespondenceService {

private final NotificationService notificationService;
private List<Document> documents;

public List<Document> emailInformationRequest(CaseDetails caseDetails) {
documents = new ArrayList<>();
try {
documents.add(notificationService
.sendEmail(CASE_STOPPED_REQUEST_INFORMATION, caseDetails));
log.info("Successful response for request for information email for case id {} ",
caseDetails.getId());
final Document notification = notificationService.sendEmail(CASE_STOPPED_REQUEST_INFORMATION, caseDetails);
log.info("Successful response for request for information email for case id {} ", caseDetails.getId());
return List.of(notification);
} catch (NotificationClientException e) {
log.error(e.getMessage());
// this feels wrong - do we not want to alert the caller that the email sending has failed?
return List.of();
}
return documents;
}
}

0 comments on commit 63bf637

Please sign in to comment.