网球请求节流
This commit is contained in:
@@ -16,11 +16,14 @@ import static com.mogo.cloud.passport.MoGoAiCloudClient.TAG;
|
||||
import static com.mogo.cloud.passport.MoGoAiCloudClientConfig.HTTP_DNS_ENV_DEV;
|
||||
import static com.mogo.cloud.passport.MoGoAiCloudClientConfig.HTTP_DNS_ENV_QA;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
public class ThirdPassportManager {
|
||||
|
||||
private static volatile ThirdPassportManager mInstance;
|
||||
private IPassport mPassport;
|
||||
|
||||
private AtomicBoolean isRequestIng = new AtomicBoolean(false);
|
||||
|
||||
private ThirdPassportManager() {
|
||||
|
||||
}
|
||||
@@ -37,9 +40,13 @@ public class ThirdPassportManager {
|
||||
}
|
||||
|
||||
public void refreshToken(Context context, IPassport passport) {
|
||||
if(isRequestIng.get()){
|
||||
return;
|
||||
}
|
||||
this.mPassport = passport;
|
||||
MoGoAiCloudClientConfig mAiCloudClientConfig = MoGoAiCloudClient.getInstance().getAiCloudClientConfig();
|
||||
if (mAiCloudClientConfig != null) {
|
||||
isRequestIng.set(true);
|
||||
ThirdLoginParam thirdLoginParam = ThirdLoginParam.of(
|
||||
mAiCloudClientConfig.getThirdPartyDeviceId(),
|
||||
mAiCloudClientConfig.getThirdPartyAppKey()
|
||||
@@ -48,6 +55,7 @@ public class ThirdPassportManager {
|
||||
LoginCallback loginCallback = new LoginCallback() {
|
||||
@Override
|
||||
public void onSuccess(TokenData.TokenResult result) {
|
||||
isRequestIng.set(false);
|
||||
if (mPassport != null) {
|
||||
mPassport.onSuccess(result.token, result.sn);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ MOGO_UTILS_VERSION=1.4.7.62
|
||||
# 网络请求
|
||||
MOGO_NETWORK_VERSION=1.4.7.62
|
||||
# 鉴权
|
||||
MOGO_PASSPORT_VERSION=1.4.7.62
|
||||
MOGO_PASSPORT_VERSION=1.4.7.63
|
||||
# 常链接
|
||||
MOGO_SOCKET_VERSION=1.4.7.62
|
||||
# 数据采集
|
||||
|
||||
Reference in New Issue
Block a user