understandingCombine
understandingCombine copied to clipboard
Retry
https://github.com/mattneub/understandingCombine/blob/236c4af76689d71d985cd00bf64a1b726101ca35/operators/operatorsErrorHandlers/operatorsRetry.txt#L35
Couldn't this be achieved without share
, by using a delayed Fail
? For example:
URLSession.shared.dataTaskPublisher(for: url)
.catch { error in
Fail(error: error).delay(for: 0.5, scheduler: DispatchQueue.main)
.eraseToAnyPublisher()
}
.retry(3)
I prefer this solution.
I also believe that the use of share
defeats the purpose of retry
. Using share should result in only one subscription being sent to the DataTaskPublisher
. Thus, only one network request is sent, even if it fails. Or is my understanding of share
wrong?