-
Notifications
You must be signed in to change notification settings - Fork 254
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: handle fatal errors in dsp http dispatcher delegate #3203
fix: handle fatal errors in dsp http dispatcher delegate #3203
Conversation
* @param message the message | ||
* @return a future that can be used to retrieve the response when the operation has completed | ||
*/ | ||
<T, M extends RemoteMessage> CompletableFuture<StatusResult<T>> dispatch(Class<T> responseType, M message); |
Check notice
Code scanning / CodeQL
Useless parameter
a05c604
to
63f4526
Compare
} | ||
|
||
@Nullable | ||
private RemoteMessageDispatcher getDispatcher(@Nullable String protocol) { | ||
if (protocol == null) { |
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.
I removed this fallback dispatcher because I couldn't see its usefulness
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## main #3203 +/- ##
==========================================
+ Coverage 65.59% 65.64% +0.04%
==========================================
Files 836 841 +5
Lines 16811 16872 +61
Branches 926 928 +2
==========================================
+ Hits 11028 11075 +47
- Misses 5415 5428 +13
- Partials 368 369 +1
☔ View full report in Codecov by Sentry. |
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.
Great stuff!
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.
🚀
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.
🧨
What this PR changes/adds
Add a new
dispatch
method on bothRemoteMessageDispatcher
andRemoteMessageDispatcherRegistry
that returnStatusResult
, doing this it has been possible catchFATAL_ERROR
s and avoid retryWhy it does that
avoid network pollution, improve error messaging
Further notes
From bottom to top:
handleResponse
method inDspHttpDispatcherDelegate
that takes the place ofparseResponse
. It takes care to look at the status code and create theStatusResult
accordingly, if response is successful, callparseResponse
(that became protected)AsyncStatusResultRetryProcess
class, that extendsCompletableFutureRetryProcess
and usesStatusResultRetryProcess
to handle theStatusResult
when the future succeeds.send
methods onRemoteMessageDispatcher
andRemoteMessageDispatcherRegistry
are now unused, but I left them there to avoid compilation errors on downstream projects.Linked Issue(s)
Closes #3202
Please be sure to take a look at the contributing guidelines and our etiquette for pull requests.