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

Fix stream cancelling for FetchPolicy.CacheAndNetwork, too #53

Merged
merged 14 commits into from
Aug 19, 2020

Conversation

knaeckeKami
Copy link
Collaborator

This fixes #51 .

This includes the changes in #52, and fixes for FetchPolicy.cacheAndNetwork policy, and extends the test for canceling the streams when they are not listened to anymore for all FetchPolicies.

I am not really sure why these fixes to FetchPolicy.cacheAndNetwork are necessary, I know too little about rxdart for this. But with wrapping the network stream in a new StreamController and manually canceling it, the canceling of the stream is passed on the Link, too.

There might be a better with rxdart, which is why I put this fix in a separate PR.

@smkhalsa
Copy link
Member

smkhalsa commented Aug 12, 2020

Thanks for the PR!

I remember there was a reason we used async await for the network request, but I'm travelling now and can't dig into it.

I'll try to take another look next week.

ferry/lib/src/client.dart Outdated Show resolved Hide resolved
ferry/lib/src/client.dart Outdated Show resolved Hide resolved
@knaeckeKami knaeckeKami marked this pull request as draft August 19, 2020 09:56
Martin Kamleithner added 3 commits August 19, 2020 12:34
Copy link
Member

@smkhalsa smkhalsa left a comment

Choose a reason for hiding this comment

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

I'd like to further investigate the FetchPolicy.CacheAndNetwork code at some point to better understand what's going on, but I think these changes are fine for now. There may be a way to refactor that doesn't require the use of shareValue at all.

Thanks again for the PR!

}

abstract class Mockable {
Copy link
Member

Choose a reason for hiding this comment

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

Did you intend to leave the Mockable & MyMock classes in here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, my bad. Of course not.

Copy link
Member

@smkhalsa smkhalsa left a comment

Choose a reason for hiding this comment

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

LGTM

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.

Link does not get notified when stream isn't listened anymore
2 participants