summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorByteHamster <info@bytehamster.com>2022-08-04 23:27:51 +0200
committerByteHamster <info@bytehamster.com>2022-08-04 23:27:51 +0200
commit3df3b5b50a998957e6536567bec12c9ba7048217 (patch)
tree2038fce0bb3581b3d19b20c1632d16118fdf5356 /net
parent938df7b7fa024f19194daacfdc78da642a8416ca (diff)
downloadAntennaPod-3df3b5b50a998957e6536567bec12c9ba7048217.zip
Fix NextCloud retrying without delay
Diffstat (limited to 'net')
-rw-r--r--net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/nextcloud/NextcloudLoginFlow.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/nextcloud/NextcloudLoginFlow.java b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/nextcloud/NextcloudLoginFlow.java
index 33e7ba490..3ad171f7f 100644
--- a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/nextcloud/NextcloudLoginFlow.java
+++ b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/nextcloud/NextcloudLoginFlow.java
@@ -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() {