将部分数据库操作移动到工作线程
This commit is contained in:
@ -2,6 +2,7 @@ package com.gh.gamecenter.manager;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.gh.common.AppExecutor;
|
||||
import com.gh.common.exposure.meta.MetaUtil;
|
||||
import com.gh.common.loghub.LoghubUtils;
|
||||
import com.gh.common.util.Installation;
|
||||
@ -37,12 +38,14 @@ public class DataCollectionManager {
|
||||
}
|
||||
|
||||
public static void onEvent(Context context, String type, Map<String, Object> map, boolean isUpload) {
|
||||
map.put("createdOn", Utils.getTime(context));
|
||||
if (isUpload) {
|
||||
DataCollectionManager.getInstance(context).realTimeUpload(type, map);
|
||||
} else {
|
||||
onEvent(context, type, new JSONObject(map).toString(), false);
|
||||
}
|
||||
AppExecutor.getLightWeightIoExecutor().execute(() -> {
|
||||
map.put("createdOn", Utils.getTime(context));
|
||||
if (isUpload) {
|
||||
DataCollectionManager.getInstance(context).realTimeUpload(type, map);
|
||||
} else {
|
||||
onEvent(context, type, new JSONObject(map).toString(), false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -91,7 +91,7 @@ public class FilterManager {
|
||||
}
|
||||
RetrofitManager.getInstance(mContext).getApi().getPackageUsed(UrlFilterUtils.getFilterQuery("since", String.valueOf(since)), skip)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.observeOn(Schedulers.io())
|
||||
.subscribe(new Response<List<PackageEntity>>() {
|
||||
@Override
|
||||
public void onResponse(List<PackageEntity> response) {
|
||||
|
||||
Reference in New Issue
Block a user