Hyperconnectivity icon indicating copy to clipboard operation
Hyperconnectivity copied to clipboard

Thrown URLError cancels the remaining URL requests and results in returning incomplete connectivity result

Open hatalyakgyula opened this issue 1 year ago • 0 comments

The following configuration is very similar to the default one but replaces one of the URLs with an unreachable one that would produce a thrown URLError during URLSession's dataTask.

let config = HyperconnectivityConfiguration(connectivityURLs: [URL(string: "https://www.apple.com/library/test/success.html"),
                                                               URL(string: "https://ab.cd.ef/123.html")].compactMap { $0 },
                                            successThreshold: Percentage(50))

According to my testing the thrown URLError happens pretty quickly and with the current implementation it will make the MergeMany publisher to complete (here)and this way cancelling all remaining/ongoing URL requests. Despite of requiring less then 100% as success threshold only one early-failing request with a thrown error can stop the MergeMany publisher and leave the ConnectivityResult in an incomplete state - that is returned to the subscriber of ConnectivityPublisher. So in case of the example I provided above only one failed URL request results in a disconnected state despite of setting only 50% as a success threshold. Could you please check the example and give some feedback if you also consider it as a bug?

hatalyakgyula avatar May 17 '24 09:05 hatalyakgyula