Skip to content

Release stream callback, once the stream has finished #1363

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

Merged
merged 4 commits into from
Feb 16, 2022

Conversation

fabianfett
Copy link
Collaborator

Motivation

Currently we don't release the stream callback once we a stream has ended. This makes it really easy for adopters to run into retain cycles, they don't expect.

Changes

  • Release callback once the grpc stream has ended.

@fabianfett fabianfett requested a review from glbrntt February 15, 2022 16:26
@fabianfett fabianfett added the 🔨 semver/patch No public API change. label Feb 15, 2022
}

internal init(on eventLoop: EventLoop, _ responseCallback: @escaping (Response) -> Void) {
self.eventLoop = eventLoop
self.responseCallback = responseCallback
self.initialMetadataPromise = eventLoop.makeLazyPromise()
self.trailingMetadataPromise = eventLoop.makeLazyPromise()
self.statusPromise = eventLoop.makeLazyPromise()
self.statusPromise = eventLoop.makePromise()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep this as a lazy promise and just replace the callback in handle and handleError?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

much better! will change!

@fabianfett fabianfett force-pushed the ff-release-stream-callback branch from 24aa4d2 to 4c0a2ea Compare February 15, 2022 18:45
@fabianfett fabianfett requested a review from glbrntt February 15, 2022 18:46
@fabianfett fabianfett force-pushed the ff-release-stream-callback branch from 4c0a2ea to 17a8ffe Compare February 16, 2022 10:28
@fabianfett fabianfett force-pushed the ff-release-stream-callback branch from 17a8ffe to 64b642f Compare February 16, 2022 10:49
@fabianfett fabianfett force-pushed the ff-release-stream-callback branch from 26fce60 to ec7d950 Compare February 16, 2022 11:34
@glbrntt glbrntt merged commit be02b34 into grpc:main Feb 16, 2022
@fabianfett fabianfett deleted the ff-release-stream-callback branch February 16, 2022 15:06
bimawa pushed a commit to StreamLayer/grpc-swift that referenced this pull request Jun 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants