Merge pull request #6000 from ByteHamster/fix-nextcloud-retry

Fix NextCloud retrying without delay
This commit is contained in:
ByteHamster 2022-08-06 10:05:42 +02:00 committed by GitHub
commit d58debbf58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 6 deletions

View File

@ -68,14 +68,13 @@ public class NextcloudLoginFlow {
private void poll() {
pollDisposable = Observable.fromCallable(() -> doRequest(URI.create(endpoint).toURL(), "token=" + token))
.delay(1, TimeUnit.SECONDS)
.retry(60 * 10) // 10 minutes
.retryWhen(t -> t.delay(1, TimeUnit.SECONDS))
.timeout(5, TimeUnit.MINUTES)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(result -> {
callback.onNextcloudAuthenticated(result.getString("server"),
result.getString("loginName"), result.getString("appPassword"));
}, Throwable::printStackTrace);
.subscribe(result -> callback.onNextcloudAuthenticated(
result.getString("server"), result.getString("loginName"), result.getString("appPassword")),
error -> callback.onNextcloudAuthError(error.getLocalizedMessage()));
}
public void cancel() {