From 023988dc2a4adc7364c7b75104836765fcc1be15 Mon Sep 17 00:00:00 2001 From: felixxfwang <514213089@qq.com> Date: Thu, 23 Nov 2017 19:16:09 +0800 Subject: [PATCH] Fix Sonic still send request in FirstLoad mode when server return Cache-Offline: http --- .../main/java/com/tencent/sonic/sdk/SonicDataHelper.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sonic-android/sdk/src/main/java/com/tencent/sonic/sdk/SonicDataHelper.java b/sonic-android/sdk/src/main/java/com/tencent/sonic/sdk/SonicDataHelper.java index cea3849..de5999a 100644 --- a/sonic-android/sdk/src/main/java/com/tencent/sonic/sdk/SonicDataHelper.java +++ b/sonic-android/sdk/src/main/java/com/tencent/sonic/sdk/SonicDataHelper.java @@ -260,8 +260,15 @@ static boolean setSonicUnavailableTime(String sessionId, long unavailableTime) { sessionData.unAvailableTime = unavailableTime; updateSessionData(db, sessionId, sessionData); return true; + } else { + sessionData = new SessionData(); + sessionData.sessionId = sessionId; + sessionData.eTag = "Unknown"; + sessionData.htmlSha1 = "Unknown"; + sessionData.unAvailableTime = unavailableTime; + insertSessionData(db, sessionId, sessionData); + return true; } - return false; } /**