-
Notifications
You must be signed in to change notification settings - Fork 2k
Open
Description
MoyaPublisher shouldn't create a network request if it receives a request demand larger then .none. It should do that only if no previous demand greater than .none was received.
func request(_ demand: Subscribers.Demand) {
guard demand > .none else { return }
cancellable = performCall()
}
I suggest changing the above code fragment to something like the following
func request(_ demand: Subscribers.Demand) {
guard demand > .none && cancellable == nil else { return }
cancellable = performCall()
}
This would be aligned with the way dataTaskPublisher works in URLSession. Subsequent subscribers get new subscriptions and new network requests are made for them, but if the same subscriber updates it's demand by calling the request(newDemand) method no new network request gets created.
ashfurrow and UnuSynth
Metadata
Metadata
Assignees
Labels
No labels