Skip to content
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

refactor(microservices): prevent grpc write promise from throwing #13368

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ssilve1989
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

currently the Observable that wraps ServerStreaming calls to write data out to the gRPC call object can reject which needs to be caught, even though the call.emit in the catch handler won't do anything because call.end() happens before that catch block can run, thanks to the unsubscribe call in the Subscription cleanup functions used inside writeObservableToGrpc

Issue Number: N/A

What is the new behavior?

This promise should just never reject in the first place. The Promise is just used to signal when writing has completed and the call has ended. The error signal is handled exclusively by emitting error on the Call.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

A series of changes recently outlined here #13360 resulted in a bug where streaming server calls that replied with errors, would crash the application with an unhandledRejection. This PR also adds a test case in the integration test for asserting that that doesn't happen again.

I renamed the integration test from sum because it no longer only tests sum-related endpoints, but the Math grpc service, so it should be called that instead (the other integration files probably should also). I piggybacked off the existing Divide function to showcase this behavior by providing a request that will result in an error on the streaming response.

@coveralls
Copy link

coveralls commented Mar 27, 2024

Pull Request Test Coverage Report for Build f34ed1b5-fe52-40ae-986d-c84b98dc9403

Details

  • 5 of 5 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.06%) to 92.187%

Totals Coverage Status
Change from base Build eacd3e56-4bed-4f5e-9bab-412a10335aab: 0.06%
Covered Lines: 6737
Relevant Lines: 7308

💛 - Coveralls

@ssilve1989 ssilve1989 force-pushed the refactor/cleanup-grpc-call-handling branch from e97b012 to 22a9245 Compare March 28, 2024 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants