-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Unable to save outbound sms during async operation [DHIS2-18586] #19415
Conversation
Quality Gate passedIssues Measures |
@@ -292,7 +286,12 @@ private void handleResponse(OutboundMessageResponse status, OutboundSms sms) { | |||
sms.setStatus(OutboundSmsStatus.FAILED); | |||
} | |||
|
|||
outboundSmsService.save(sms); | |||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Who is calling this method?
Why the user is not present?
This doesn't seem to be running in another thread, if I am wrong, who is starting the thread?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Who is calling this method?
Line 491 in fd2b421
messageSender.sendMessageAsync( |
Why the user is not present?
because this is an async operation.
This doesn't seem to be running in another thread, if I am wrong, who is starting the thread?
Line 122 in fd2b421
public Future<OutboundMessageResponse> sendMessageAsync( |
@@ -122,7 +123,7 @@ public OutboundMessageResponse sendMessage( | |||
public Future<OutboundMessageResponse> sendMessageAsync( | |||
String subject, String text, String footer, User sender, Set<User> users, boolean forceSend) { | |||
OutboundMessageResponse response = sendMessage(subject, text, footer, sender, users, forceSend); | |||
return new AsyncResult<>(response); | |||
return CompletableFuture.completedFuture(response); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is doing nothing, it is not running sendMessage in a different thread and it is not running it in parallel.
Would it make sense to just return the response?
DHIS2-18586
Async operation tries to save outboundSMS and it fails due to currentUser not set. This PR injects currentUser using AuthenticationService.