CombineCommunity / CombineExt

CombineExt provides a collection of operators, publishers and utilities for Combine, that are not provided by Apple themselves, but are common in other Reactive Frameworks and standards.
https://combine.community
MIT License
1.72k stars 151 forks source link

Yet Another Fix for RetryWhen #151

Closed Kn1kt closed 2 weeks ago

Kn1kt commented 1 year ago

Continuation of Update testSuccessfulRetry and code to make it pass. #150

First commit

  1. When RetryWhen changes upstream to Sink, the subscription to the previous upstream must be canceled in order not to receive unnecessary events.
  2. You also need to re-request from the new upstream demand, which was not received from the previous upstream.

Second commit

Adds tests for both cases described above

Third commit

Added explicit cancellation of subscriptions in the cancel() method call. Because deinit on Sink can be called after a while, forcing the publisher to work. This causes a lot of problems when using RetryWhen in cells of collections or tables, where the cancel() method can be called very often and the deinit call on Sink can occur after a few tens of seconds.