alpha-wallet-ios
alpha-wallet-ios copied to clipboard
Verify Combine + retry works as expected
I've pushed a branch to https://github.com/AlphaWallet/alpha-wallet-ios/tree/try-retry which modifies RetryPublisherTests.testRetryWithRandomDelay. Try running just that test case:
2022-09-20 15:44:48.666034+0800 AlphaWallet[31013:44728174] xxx in deferred which will return the future from: testRetryWithRandomDelay()
2022-09-20 15:44:48.668375+0800 AlphaWallet[31013:44728175] xxx in future from: testRetryWithRandomDelay()
2022-09-20 15:44:48.980830+0800 AlphaWallet[31013:44728176] xxx sabotage from: instrumentedAsyncAPICall(sabotage:completion:)
2022-09-20 15:44:48.999677+0800 AlphaWallet[31013:44728176] xxx in deferred which will return the future from: testRetryWithRandomDelay()
2022-09-20 15:44:49.013350+0800 AlphaWallet[31013:44728176] xxx in future from: testRetryWithRandomDelay()
2022-09-20 15:44:49.030854+0800 AlphaWallet[31013:44728176] xxx sabotage from: instrumentedAsyncAPICall(sabotage:completion:)
2022-09-20 15:44:49.037519+0800 AlphaWallet[31013:44728176] xxx in deferred which will return the future from: testRetryWithRandomDelay()
2022-09-20 15:44:49.044559+0800 AlphaWallet[31013:44728176] xxx in future from: testRetryWithRandomDelay()
2022-09-20 15:44:49.048357+0800 AlphaWallet[31013:44728176] xxx sabotage from: instrumentedAsyncAPICall(sabotage:completion:)
2022-09-20 15:44:49.059946+0800 AlphaWallet[31013:44728176] xxx in deferred which will return the future from: testRetryWithRandomDelay()
2022-09-20 15:44:49.061613+0800 AlphaWallet[31013:44728176] xxx in future from: testRetryWithRandomDelay()
2022-09-20 15:44:49.064682+0800 AlphaWallet[31013:44728176] xxx sabotage from: instrumentedAsyncAPICall(sabotage:completion:)
2022-09-20 15:44:49.065389+0800 AlphaWallet[31013:44728176] xxx in deferred which will return the future from: testRetryWithRandomDelay()
2022-09-20 15:44:49.089505+0800 AlphaWallet[31013:44728175] xxx in future from: testRetryWithRandomDelay()
2022-09-20 15:44:49.191926+0800 AlphaWallet[31013:44728175] xxx sabotage from: instrumentedAsyncAPICall(sabotage:completion:)
Note that the lines with "xxx sabotage" is within 1 second but the test case has been modified to retry like this:
let resultPublisher = upstreamPublisher.retry(.randomDelayed(retries: 4, delayBeforeRetry: 10, delayUpperRangeValueFrom0To: 100), scheduler: DispatchQueue.global())
Did I misunderstand how it should work?
checking
pushed wip commit, now it looks ok, check on your side. and if its ok, i will make cleanup
@oa-s yeah, looks right as it's delayed now. The test case sometimes (always?) fails for me, but maybe because I tweaked the parameters?
can u show error message?
if its about expectation timeout, you can it depends from retry range, u can play with it, if its about calls count or something else that is code error.
@oa-s seems to work now, no idea why. But looks like the delay is working. Thanks!
Closed via https://github.com/AlphaWallet/alpha-wallet-ios/pull/5431