Commit e554aa35 authored by zhang_z's avatar zhang_z

百富重试次数为6,时间间隔为5s;

parent 2d07da59
...@@ -31,7 +31,7 @@ public class RetryHelper implements Function<Observable<Throwable>, ObservableSo ...@@ -31,7 +31,7 @@ public class RetryHelper implements Function<Observable<Throwable>, ObservableSo
LogUtils.e("重试时间:" + retryTime + "重试:" + nowCount); LogUtils.e("重试时间:" + retryTime + "重试:" + nowCount);
return Observable.timer(retryTime, TimeUnit.MILLISECONDS); return Observable.timer(retryTime, TimeUnit.MILLISECONDS);
} }
return Observable.error(throwable); return Observable.error(new IOException("支付超时"));
} else { } else {
return Observable.error(throwable); return Observable.error(throwable);
} }
......
...@@ -6,10 +6,15 @@ class C { ...@@ -6,10 +6,15 @@ class C {
*/ */
static final String VERSION = "V1.0"; static final String VERSION = "V1.0";
/**
* 重试次数
*/
static final int RETRY_COUNT = 6;
/** /**
* 重试延迟时间 * 重试延迟时间
*/ */
static final int RETRY_DELAY_TIME = 60 * 1000; static final int RETRY_DELAY_TIME = 5 * 1000;
/** /**
* 测试数据 * 测试数据
......
...@@ -22,7 +22,7 @@ public class Factory extends com.xingdata.zxpay.api.Factory { ...@@ -22,7 +22,7 @@ public class Factory extends com.xingdata.zxpay.api.Factory {
public static <T> Observable<T> run(Observable<T> observable) { public static <T> Observable<T> run(Observable<T> observable) {
return observable.subscribeOn(Schedulers.io()) return observable.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.retryWhen(new RetryHelper(3, C.RETRY_DELAY_TIME)); .retryWhen(new RetryHelper(C.RETRY_COUNT, C.RETRY_DELAY_TIME));
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment