Make send-notification best effort - #701
Open
jakub-id wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes the patron-request send-notification action “best effort” by preventing email delivery problems (or email service unavailability) from failing the overall action execution, while updating unit tests to reflect the new success semantics.
Changes:
- Treat email notification failures and “email service not ready” as
EventStatusSuccess, returning a note instead of an error status. - Introduce a helper to centralize “log + return success” behavior for notification errors.
- Update
TestSendEmailNotificationexpectations from error results to success + note.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| broker/patron_request/service/action.go | Switch notification error handling to “log and return success” via a shared helper. |
| broker/patron_request/service/action_test.go | Update notification tests to assert success status and result.Note instead of error status. |
Comment on lines
+1091
to
1098
| func logNotificationErrorAndReturnSuccess(ctx common.ExtendedContext, pr pr_db.PatronRequest, msg string, err error) actionExecutionResult { | ||
| ctx.Logger().Error(msg, "error", err) | ||
| return actionExecutionResult{ | ||
| status: events.EventStatusSuccess, | ||
| result: &events.EventResult{CommonEventData: events.CommonEventData{Note: msg}}, | ||
| pr: pr, | ||
| } | ||
| } |
Comment on lines
706
to
710
| func (a *PatronRequestActionService) sendNotificationBorrowingRequest(ctx common.ExtendedContext, pr pr_db.PatronRequest, params actionParams) actionExecutionResult { | ||
| if !a.emailService.IsReadyToSend() { | ||
| return actionExecutionResult{status: events.EventStatusSuccess, result: &events.EventResult{CommonEventData: events.CommonEventData{Note: "email service is not ready to send"}}, pr: pr} | ||
| return logNotificationErrorAndReturnSuccess(ctx, pr, "email service is not ready to send", nil) | ||
| } | ||
| return a.sendEmailNotification(ctx, pr, params, pr.RequesterSymbol.String) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.