Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于Cube网络请求调用缓存的BUG #51

Open
Khaos116 opened this issue Jun 9, 2015 · 0 comments
Open

关于Cube网络请求调用缓存的BUG #51

Khaos116 opened this issue Jun 9, 2015 · 0 comments

Comments

@Khaos116
Copy link

Khaos116 commented Jun 9, 2015

在CacheAbleRequest类中, public void onRequestFail(FailData failData) {}方法中的
if(null != this.mHandler) {
this.mHandler.onRequestFail(failData);
if(this.mCacheData != null && !this.cacheIsDisabled() && !this.mUseCacheAnyway) {
this.notifyRequestFinish(CacheAbleRequest.ResultType.USE_CACHE_ON_FAIL, this.mCacheData, true);
}
}
这段代码在满足条件的情况下会执行onRequestFail和notifyRequestFinish,导致回调时执行onRequestFail和onCacheAbleRequestFinish方法。对于APP来说判断不好使用,既执行了失败,又成功返回了结果。如果在不影响其他功能的情况下,建议改为 if(null != this.mHandler) {

            if(this.mCacheData != null && !this.cacheIsDisabled() && !this.mUseCacheAnyway) {
                this.notifyRequestFinish(CacheAbleRequest.ResultType.USE_CACHE_ON_FAIL, this.mCacheData, true);
            }else{
                this.mHandler.onRequestFail(failData);
             }
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant