fix(rate-limit): 完善服务端限流场景的请求与重试策略
- fetchConfig 增加限流冷却判断,冷却期内挂起请求延迟后重试 - 限流冷却截止时间落盘持久化,进程重启后不立即触发限流 - 限流响应不再覆盖本地已成功应用的配置,保留离线可用数据 - 重试延时在指数退避基础上叠加随机抖动,避免集中重试 - updateAdminInfo 增加 5 分钟节流窗口与 AtomicBoolean 并发保护 - 时间回拨时自动重置节流基准,防止窗口被异常拉长 - TimeManager 对限流错误降级日志,不打印完整堆栈 - AGENTS.md 补充配置常量归属规范
This commit is contained in:
1 parent
70f5b28481
commit
5528dbdb12
5 files changed
+111
-19
No files matched your search
@@ -61,7 +61,7 @@
|
|||||||
| `base/BaseApplication` | 单例、MMKV/推送/Aria/Bugly 初始化,启动全部常驻服务;非主进程不初始化 |
|
| `base/BaseApplication` | 单例、MMKV/推送/Aria/Bugly 初始化,启动全部常驻服务;非主进程不初始化 |
|
||||||
| `network/NetInterfaceManager` | 唯一网络出口:Retrofit 实例、`withCache`/`withMultiLevelCache`、`IN_FLIGHT_REQUESTS` 合并并发请求、`removeCache` |
|
| `network/NetInterfaceManager` | 唯一网络出口:Retrofit 实例、`withCache`/`withMultiLevelCache`、`IN_FLIGHT_REQUESTS` 合并并发请求、`removeCache` |
|
||||||
| `network/cache/RxCacheManager` | 内存缓存(带 TTL);磁盘缓存走 `disklrucache/CacheHelper` |
|
| `network/cache/RxCacheManager` | 内存缓存(带 TTL);磁盘缓存走 `disklrucache/CacheHelper` |
|
||||||
| `network/UrlAddress` + `network/api/*` | 接口路径常量与 Retrofit 接口(返回 RxJava3 `Observable`) |
|
| `network/UrlAddress` + `network/api/*` | `UrlAddress` 只存接口路径;Retrofit 接口返回 RxJava3 `Observable`。配置 key 放 `CommonConfig` |
|
||||||
| `push/PushManager` | 推送消息分发(`setPushContent` 的 case 编号 = 后台协议号)、防抖/节流/错峰 |
|
| `push/PushManager` | 推送消息分发(`setPushContent` 的 case 编号 = 后台协议号)、防抖/节流/错峰 |
|
||||||
| `install/AppInstaller` | 强制安装/重装应用、非自身安装包的 1 分钟内随机错峰下载 |
|
| `install/AppInstaller` | 强制安装/重装应用、非自身安装包的 1 分钟内随机错峰下载 |
|
||||||
| `install/UpgradeScheduler` | 自身升级的夜间窗口、任务落盘与恢复、错峰下载 |
|
| `install/UpgradeScheduler` | 自身升级的夜间窗口、任务落盘与恢复、错峰下载 |
|
||||||
@@ -181,6 +181,9 @@
|
|||||||
不要新建 MMKV id(每个 id 是独立文件,多进程下会出现读写不一致),
|
不要新建 MMKV id(每个 id 是独立文件,多进程下会出现读写不一致),
|
||||||
也不要把业务状态分散到新的 `SharedPreferences`。
|
也不要把业务状态分散到新的 `SharedPreferences`。
|
||||||
`utils/SPUtils` 是既有单进程封装,旧代码沿用原类即可,不要为同一份数据再开一套存储。
|
`utils/SPUtils` 是既有单进程封装,旧代码沿用原类即可,不要为同一份数据再开一套存储。
|
||||||
|
- **常量归属**:`core/data/remote/UrlAddress` 只用于存放接口路径;KVStore/MMKV key、时间戳、
|
||||||
|
缓存快照 key 等配置键统一放 `core/common/config/CommonConfig`。
|
||||||
|
`UrlAddress` 中历史遗留的配置键不要顺手迁移,等专门任务处理,避免影响已缓存数据。
|
||||||
- 单例沿用现有约定:`init(Context)` 初始化 + `getInstance()` 未初始化时抛
|
- 单例沿用现有约定:`init(Context)` 初始化 + `getInstance()` 未初始化时抛
|
||||||
`IllegalStateException`,不要返回 null 静默失败。
|
`IllegalStateException`,不要返回 null 静默失败。
|
||||||
- 不新增依赖、不改 `applicationId`/`sharedUserId`/签名配置,除非任务明确要求。
|
- 不新增依赖、不改 `applicationId`/`sharedUserId`/签名配置,除非任务明确要求。
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ public class CommonConfig {
|
|||||||
public static final String MAP_onLocationChanged_time_KEY = "map_onLocationChanged_time_key";
|
public static final String MAP_onLocationChanged_time_KEY = "map_onLocationChanged_time_key";
|
||||||
public static final String MAP_BEAN = "MapBean";
|
public static final String MAP_BEAN = "MapBean";
|
||||||
|
|
||||||
|
/*设备基本信息上次上报时间(毫秒),用于 sn/updateAdminSn 的 5 分钟节流*/
|
||||||
|
public static final String UPDATE_SN_INFO_LAST_TIME = "update_admin_sn_last_time";
|
||||||
|
|
||||||
|
|
||||||
/*首次开机*/
|
/*首次开机*/
|
||||||
public static final String JGY_FIRST_BOOT = "first_boot";
|
public static final String JGY_FIRST_BOOT = "first_boot";
|
||||||
|
|||||||
@@ -5,21 +5,19 @@ import android.content.Context;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.fuying.sn.core.data.dto.time.AppTimeControlInfo;
|
import com.fuying.sn.core.common.gson.GsonUtils;
|
||||||
import com.fuying.sn.core.data.dto.common.BaseResponse;
|
import com.fuying.sn.core.data.dto.common.BaseResponse;
|
||||||
import com.fuying.sn.core.data.dto.device.SnInfo;
|
import com.fuying.sn.core.data.dto.device.SnInfo;
|
||||||
|
import com.fuying.sn.core.data.dto.time.AppTimeControlInfo;
|
||||||
import com.fuying.sn.core.data.dto.time.SnTimeControlInfo;
|
import com.fuying.sn.core.data.dto.time.SnTimeControlInfo;
|
||||||
import com.fuying.sn.core.common.config.CommonConfig;
|
|
||||||
import com.fuying.sn.core.data.repository.DeviceRepository;
|
|
||||||
import com.fuying.sn.core.data.remote.UrlAddress;
|
|
||||||
import com.fuying.sn.core.common.gson.GsonUtils;
|
|
||||||
import com.fuying.sn.core.data.local.db.time.AppRemainingEntity;
|
import com.fuying.sn.core.data.local.db.time.AppRemainingEntity;
|
||||||
import com.fuying.sn.core.data.local.db.time.AppTimeControlEntity;
|
import com.fuying.sn.core.data.local.db.time.AppTimeControlEntity;
|
||||||
import com.fuying.sn.core.data.local.db.time.TimeControlDao;
|
import com.fuying.sn.core.data.local.db.time.TimeControlDao;
|
||||||
import com.fuying.sn.core.data.local.db.time.TimeControlDatabase;
|
import com.fuying.sn.core.data.local.db.time.TimeControlDatabase;
|
||||||
|
import com.fuying.sn.core.data.local.prefs.KVStore;
|
||||||
|
import com.fuying.sn.core.data.remote.UrlAddress;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.fuying.sn.core.data.local.prefs.KVStore;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -61,6 +59,10 @@ public class TimeConfigRepository {
|
|||||||
private static final long RETRY_TOO_FREQUENT_INTERVAL_MS = TimeUnit.MINUTES.toMillis(5); // 限流码退避
|
private static final long RETRY_TOO_FREQUENT_INTERVAL_MS = TimeUnit.MINUTES.toMillis(5); // 限流码退避
|
||||||
private static final int MAX_RETRY_COUNT = 10; // 最大重试次数,超过后停止重试
|
private static final int MAX_RETRY_COUNT = 10; // 最大重试次数,超过后停止重试
|
||||||
private static final Random RETRY_RANDOM = new Random();
|
private static final Random RETRY_RANDOM = new Random();
|
||||||
|
/**
|
||||||
|
* 服务端返回“请求过于频繁”后的冷却截止时间,落盘保存,进程重启后也不会立即再次触发限流。
|
||||||
|
*/
|
||||||
|
private static final String CONFIG_TOO_FREQUENT_UNTIL = "config_too_frequent_until";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据库写调度器:单线程保证 clear + insert 等组合操作的提交顺序。
|
* 数据库写调度器:单线程保证 clear + insert 等组合操作的提交顺序。
|
||||||
@@ -250,10 +252,26 @@ public class TimeConfigRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param forceRefresh true 时先失效内存中的两级管控配置,保证显式刷新一定回源;
|
* @param forceRefresh true 时在限流冷却结束后失效内存中的两级管控配置,保证显式刷新一定回源;
|
||||||
* 磁盘缓存保留,作为离线时的兜底数据
|
* 磁盘缓存保留,作为离线时的兜底数据
|
||||||
*/
|
*/
|
||||||
public Observable<Boolean> fetchConfig(boolean forceRefresh) {
|
public Observable<Boolean> fetchConfig(boolean forceRefresh) {
|
||||||
|
// 限流冷却期内不发起任何网络请求;用 defer 保证延迟结束后重新判断冷却状态。
|
||||||
|
return Observable.defer(() -> {
|
||||||
|
long remaining = getTooFrequentRemainingMillis();
|
||||||
|
if (remaining > 0) {
|
||||||
|
Log.e(TAG, "fetchConfig: 配置请求处于限流冷却,延后 " + remaining + "ms");
|
||||||
|
return Observable.timer(remaining, TimeUnit.MILLISECONDS)
|
||||||
|
.flatMap(ignored -> fetchConfig(forceRefresh));
|
||||||
|
}
|
||||||
|
return startConfigFetch(forceRefresh);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 真正发起三路配置请求。限流冷却结束后由 {@link #fetchConfig(boolean)} 调用。
|
||||||
|
*/
|
||||||
|
private Observable<Boolean> startConfigFetch(boolean forceRefresh) {
|
||||||
if (forceRefresh) {
|
if (forceRefresh) {
|
||||||
DeviceRepository.getInstance().invalidateMemory(UrlAddress.SN_TIME_CONTROL);
|
DeviceRepository.getInstance().invalidateMemory(UrlAddress.SN_TIME_CONTROL);
|
||||||
DeviceRepository.getInstance().invalidateMemory(UrlAddress.APP_TIME_CONTROL);
|
DeviceRepository.getInstance().invalidateMemory(UrlAddress.APP_TIME_CONTROL);
|
||||||
@@ -262,22 +280,22 @@ public class TimeConfigRepository {
|
|||||||
DeviceRepository.getInstance().getSnTimeControlObservable()
|
DeviceRepository.getInstance().getSnTimeControlObservable()
|
||||||
.map(resp -> {
|
.map(resp -> {
|
||||||
Log.e(TAG, "fetchConfigOnce: sn resp=" + resp);
|
Log.e(TAG, "fetchConfigOnce: sn resp=" + resp);
|
||||||
handleSnResponse(resp);
|
// 限流响应不覆盖本地已成功应用的配置,保留离线可用数据。
|
||||||
// 业务状态码中仅将 400 转为异常重试;网络等异常也会进入该路重试流程。
|
|
||||||
if (resp.code == 400) {
|
if (resp.code == 400) {
|
||||||
throw new ConfigRetryException("SN config too frequent, code=400");
|
throw new ConfigRetryException("SN config too frequent, code=400");
|
||||||
}
|
}
|
||||||
|
handleSnResponse(resp);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
Observable<Boolean> app =
|
Observable<Boolean> app =
|
||||||
DeviceRepository.getInstance().getAppTimeControlInfoObservable()
|
DeviceRepository.getInstance().getAppTimeControlInfoObservable()
|
||||||
.map(resp -> {
|
.map(resp -> {
|
||||||
Log.e(TAG, "fetchConfigOnce: app resp=" + resp);
|
Log.e(TAG, "fetchConfigOnce: app resp=" + resp);
|
||||||
handleAppResponse(resp);
|
// 限流响应不覆盖本地已成功应用的配置,保留离线可用数据。
|
||||||
// 业务状态码中仅将 400 转为异常重试;网络等异常也会进入该路重试流程。
|
|
||||||
if (resp.code == 400) {
|
if (resp.code == 400) {
|
||||||
throw new ConfigRetryException("App config too frequent, code=400");
|
throw new ConfigRetryException("App config too frequent, code=400");
|
||||||
}
|
}
|
||||||
|
handleAppResponse(resp);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
Observable<Boolean> snInfo =
|
Observable<Boolean> snInfo =
|
||||||
@@ -307,8 +325,13 @@ public class TimeConfigRepository {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
long delay = retryDelayMillis(error, attempt);
|
long delay = retryDelayMillis(error, attempt);
|
||||||
|
if (error instanceof ConfigRetryException) {
|
||||||
|
Log.e(TAG, "Config fetch rate limited, retry " + attempt + "/" + MAX_RETRY_COUNT
|
||||||
|
+ " after " + delay + "ms");
|
||||||
|
} else {
|
||||||
Log.e(TAG, "Config fetch failed, retry " + attempt + "/" + MAX_RETRY_COUNT
|
Log.e(TAG, "Config fetch failed, retry " + attempt + "/" + MAX_RETRY_COUNT
|
||||||
+ " after " + delay + "ms", error);
|
+ " after " + delay + "ms", error);
|
||||||
|
}
|
||||||
return delay;
|
return delay;
|
||||||
})
|
})
|
||||||
.concatMap(delay -> Observable.timer(delay, TimeUnit.MILLISECONDS)));
|
.concatMap(delay -> Observable.timer(delay, TimeUnit.MILLISECONDS)));
|
||||||
@@ -333,18 +356,34 @@ public class TimeConfigRepository {
|
|||||||
* 指数退避 + 随机抖动,避免大量设备同一时刻集中重试。
|
* 指数退避 + 随机抖动,避免大量设备同一时刻集中重试。
|
||||||
*/
|
*/
|
||||||
private long retryDelayMillis(Throwable error, int attempt) {
|
private long retryDelayMillis(Throwable error, int attempt) {
|
||||||
long delay;
|
|
||||||
if (error instanceof ConfigRetryException) {
|
if (error instanceof ConfigRetryException) {
|
||||||
// 业务码 400 表示请求过于频繁,继续用短间隔重试只会延长限流时间
|
long delay = tooFrequentDelayMillis();
|
||||||
delay = RETRY_TOO_FREQUENT_INTERVAL_MS;
|
// 冷却时间与本次重试延时使用同一个值,避免外部触发在退避到期前再次请求
|
||||||
} else {
|
KVStore.encode(CONFIG_TOO_FREQUENT_UNTIL, System.currentTimeMillis() + delay);
|
||||||
long exponential = RETRY_BASE_INTERVAL_MS << Math.min(attempt - 1, 4);
|
return delay;
|
||||||
delay = Math.min(exponential, RETRY_MAX_INTERVAL_MS);
|
|
||||||
}
|
}
|
||||||
|
long exponential = RETRY_BASE_INTERVAL_MS << Math.min(attempt - 1, 4);
|
||||||
|
long delay = Math.min(exponential, RETRY_MAX_INTERVAL_MS);
|
||||||
long jitter = (long) (delay * 0.2 * RETRY_RANDOM.nextDouble());
|
long jitter = (long) (delay * 0.2 * RETRY_RANDOM.nextDouble());
|
||||||
return delay + jitter;
|
return delay + jitter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 限流冷却时长,在 5 分钟基础上叠加 20% 随机抖动。
|
||||||
|
*/
|
||||||
|
private long tooFrequentDelayMillis() {
|
||||||
|
return RETRY_TOO_FREQUENT_INTERVAL_MS
|
||||||
|
+ (long) (RETRY_TOO_FREQUENT_INTERVAL_MS * 0.2 * RETRY_RANDOM.nextDouble());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 剩余限流冷却时间;无冷却时返回 0。
|
||||||
|
*/
|
||||||
|
private long getTooFrequentRemainingMillis() {
|
||||||
|
long until = KVStore.decodeLong(CONFIG_TOO_FREQUENT_UNTIL, 0L);
|
||||||
|
return Math.max(0L, until - System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
|
||||||
// --- 内部处理:单级响应更新 ---
|
// --- 内部处理:单级响应更新 ---
|
||||||
|
|
||||||
private void handleSnResponse(BaseResponse<SnTimeControlInfo> response) {
|
private void handleSnResponse(BaseResponse<SnTimeControlInfo> response) {
|
||||||
@@ -579,6 +618,13 @@ public class TimeConfigRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 供调用方识别服务端限流错误,降级日志而不打印完整堆栈。
|
||||||
|
*/
|
||||||
|
public static boolean isTooFrequentError(Throwable error) {
|
||||||
|
return error instanceof ConfigRetryException;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务层请求失败(HTTP 成功但 BaseResponse.code != 200,如 400 请求过于频繁)时抛出,
|
* 业务层请求失败(HTTP 成功但 BaseResponse.code != 200,如 400 请求过于频繁)时抛出,
|
||||||
* 用于触发 retryWhen 的延时重试。
|
* 用于触发 retryWhen 的延时重试。
|
||||||
|
|||||||
@@ -965,8 +965,12 @@ public class TimeManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable error) {
|
public void onError(Throwable error) {
|
||||||
|
if (TimeConfigRepository.isTooFrequentError(error)) {
|
||||||
|
Log.e(TAG, "fetchConfigWithRetry: 服务端限流,保留本地配置并等待冷却结束");
|
||||||
|
} else {
|
||||||
Log.e(TAG, "Config fetch failed after retries", error);
|
Log.e(TAG, "Config fetch failed after retries", error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import com.fuying.sn.platform.system.AndroidSettingsWriter;
|
|||||||
import com.fuying.sn.platform.system.JgyUtils;
|
import com.fuying.sn.platform.system.JgyUtils;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import io.reactivex.rxjava3.annotations.NonNull;
|
import io.reactivex.rxjava3.annotations.NonNull;
|
||||||
import io.reactivex.rxjava3.core.Completable;
|
import io.reactivex.rxjava3.core.Completable;
|
||||||
import io.reactivex.rxjava3.core.Observer;
|
import io.reactivex.rxjava3.core.Observer;
|
||||||
@@ -32,11 +34,19 @@ import io.reactivex.rxjava3.disposables.Disposable;
|
|||||||
*/
|
*/
|
||||||
public final class DeviceProfileSync {
|
public final class DeviceProfileSync {
|
||||||
private static final String TAG = "DeviceProfileSync";
|
private static final String TAG = "DeviceProfileSync";
|
||||||
|
/**
|
||||||
|
* updateAdminSn 接口最小请求间隔,服务端限流要求 5 分钟内只请求一次。
|
||||||
|
*/
|
||||||
|
private static final long REPORT_INTERVAL_MS = 5 * 60 * 1000L;
|
||||||
|
|
||||||
private static volatile DeviceProfileSync instance;
|
private static volatile DeviceProfileSync instance;
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final ContentResolver crv;
|
private final ContentResolver crv;
|
||||||
private final DeviceRepository repository;
|
private final DeviceRepository repository;
|
||||||
|
/**
|
||||||
|
* 标记是否有上报请求在途,避免多个触发源同时命中时间窗口边界时重复发请求。
|
||||||
|
*/
|
||||||
|
private final AtomicBoolean mReporting = new AtomicBoolean(false);
|
||||||
|
|
||||||
|
|
||||||
private DeviceProfileSync(Context context) {
|
private DeviceProfileSync(Context context) {
|
||||||
@@ -138,6 +148,23 @@ public final class DeviceProfileSync {
|
|||||||
|
|
||||||
|
|
||||||
public void updateAdminInfo() {
|
public void updateAdminInfo() {
|
||||||
|
long now = System.currentTimeMillis();
|
||||||
|
long lastReportTime = KVStore.decodeLong(CommonConfig.UPDATE_SN_INFO_LAST_TIME, 0L);
|
||||||
|
if (now < lastReportTime) {
|
||||||
|
// 系统时间被回拨时重置基准,避免节流窗口被异常拉长
|
||||||
|
lastReportTime = 0L;
|
||||||
|
}
|
||||||
|
if (now - lastReportTime < REPORT_INTERVAL_MS) {
|
||||||
|
Log.e(TAG, "updateAdminInfo: 5分钟内已上报,跳过, 剩余 = "
|
||||||
|
+ (REPORT_INTERVAL_MS - (now - lastReportTime)) + "ms");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!mReporting.compareAndSet(false, true)) {
|
||||||
|
Log.e(TAG, "updateAdminInfo: 已有上报请求进行中,跳过");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boolean requestSubmitted = false;
|
||||||
|
try {
|
||||||
String address = String.valueOf(KVStore.decodeString(CommonConfig.MAP_ADDRESS_KEY, "-"));
|
String address = String.valueOf(KVStore.decodeString(CommonConfig.MAP_ADDRESS_KEY, "-"));
|
||||||
String longitude = String.valueOf(KVStore.decodeDouble(CommonConfig.MAP_LONGITUDE_KEY, 0L));
|
String longitude = String.valueOf(KVStore.decodeDouble(CommonConfig.MAP_LONGITUDE_KEY, 0L));
|
||||||
String latitude = String.valueOf(KVStore.decodeDouble(CommonConfig.MAP_LATITUDE_KEY, 0L));
|
String latitude = String.valueOf(KVStore.decodeDouble(CommonConfig.MAP_LATITUDE_KEY, 0L));
|
||||||
@@ -177,6 +204,8 @@ public final class DeviceProfileSync {
|
|||||||
Log.e(TAG, "updateAdminInfo: skip");
|
Log.e(TAG, "updateAdminInfo: skip");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// 成功、失败都占用 5 分钟窗口,避免失败后立刻重试持续打服务端
|
||||||
|
KVStore.encode(CommonConfig.UPDATE_SN_INFO_LAST_TIME, now);
|
||||||
repository.reportDeviceInfo(addr, machine, hardware, software)
|
repository.reportDeviceInfo(addr, machine, hardware, software)
|
||||||
.to(BackgroundRequests.submit(new Observer<BaseResponse>() {
|
.to(BackgroundRequests.submit(new Observer<BaseResponse>() {
|
||||||
@Override
|
@Override
|
||||||
@@ -190,18 +219,25 @@ public final class DeviceProfileSync {
|
|||||||
KVStore.encode(UrlAddress.UPDATE_SN_INFO, string);
|
KVStore.encode(UrlAddress.UPDATE_SN_INFO, string);
|
||||||
}
|
}
|
||||||
Log.e(TAG, "updateAdminInfo: onNext: " + baseResponse);
|
Log.e(TAG, "updateAdminInfo: onNext: " + baseResponse);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(@NonNull Throwable e) {
|
public void onError(@NonNull Throwable e) {
|
||||||
Log.e(TAG, "updateAdminInfo: onError: " + e.getMessage());
|
Log.e(TAG, "updateAdminInfo: onError: " + e.getMessage());
|
||||||
|
mReporting.set(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onComplete() {
|
public void onComplete() {
|
||||||
Log.e(TAG, "updateAdminInfo: onComplete: ");
|
Log.e(TAG, "updateAdminInfo: onComplete: ");
|
||||||
|
mReporting.set(false);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
requestSubmitted = true;
|
||||||
|
} finally {
|
||||||
|
if (!requestSubmitted) {
|
||||||
|
mReporting.set(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user