[fix]
[passwor 获取sn和token 只有有一个在申请 除非成功、token 失效重试加日志]
This commit is contained in:
yangyakun
2025-03-27 17:52:21 +08:00
parent a09bcb37f8
commit 364b17c125
3 changed files with 4 additions and 3 deletions

View File

@@ -15,7 +15,6 @@ class FRetryWithTime<T : BaseData> : Function<T, ObservableSource<T>> {
override fun apply(baseData: T): ObservableSource<T> {
baseData.let {
if (it.code == 100046 || it.code == 100045 || it.code == 100005 || it.code == 100006 || it.code == 520003) {
MoGoAiCloudClient.getInstance().refreshToken()
return Observable.error(OchCommonRetryException())
}else if(it.code == 1003){
CallerLogger.e(M_OCHCOMMON, "接口失败报错 1003:需重新查询登录状态")

View File

@@ -3,6 +3,7 @@ package com.mogo.och.common.module.network.interceptor
import com.mogo.eagle.core.utilcode.constant.TimeConstants
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.util.TimeUtils
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
import com.mogo.och.common.module.utils.CallerLoggerUtils.flavorTag
import io.reactivex.Observable
import io.reactivex.ObservableSource
@@ -15,12 +16,13 @@ class RetryWithTime : Function<Observable<Throwable?>, ObservableSource<Any?>> {
private const val TAG = "RetryWithTime"
}
var current = -1
private var timeDelys = intArrayOf(3, 1, 2)
private var timeDelys = intArrayOf(6, 2, 4)
override fun apply(throwableObservable: Observable<Throwable?>): ObservableSource<Any?>? {
return throwableObservable.flatMap {
++current
CallerLogger.e("${flavorTag}$TAG", " 时间:${TimeUtils.getStringByNow(0, TimeConstants.SEC)}")
if (it is OchCommonRetryException && current < timeDelys.size) {
OchChainLogManager.writeChainLogError("token超时","${timeDelys[current]}s后重试")
Observable.timer(timeDelys[current].toLong(), TimeUnit.SECONDS)
} else {
Observable.error(it)

View File

@@ -66,7 +66,7 @@ LOGLIB_VERSION=1.10.18
# 网络请求LOGLIB_VERSION
MOGO_NETWORK_VERSION=1.4.7.58
# 鉴权
MOGO_PASSPORT_VERSION=1.4.7.58
MOGO_PASSPORT_VERSION=1.4.7.63
# 长链接
MOGO_SOCKET_VERSION=1.4.7.58
# 数据采集