Skip to content

Commit 2519f6e

Browse files
committed
Increase client side timeout
Also reduce loglevel to warning as an error is returned anyways, it's up to the developer to handle the way they want Also move configuration of the timeout limit to a central place
1 parent d6bf863 commit 2519f6e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Runtime/Client/LootLockerBaseServerAPI.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ IEnumerator coroutine()
7777
webRequest.downloadHandler = new DownloadHandlerBuffer();
7878

7979
float startTime = Time.time;
80-
float maxTimeOutSeconds = 5f;
8180
bool timedOut = false;
8281

8382
UnityWebRequestAsyncOperation unityWebRequestAsyncOperation = webRequest.SendWebRequest();
@@ -88,15 +87,15 @@ IEnumerator coroutine()
8887
return true;
8988
}
9089

91-
timedOut = !unityWebRequestAsyncOperation.isDone && Time.time - startTime >= maxTimeOutSeconds;
90+
timedOut = !unityWebRequestAsyncOperation.isDone && Time.time - startTime >= LootLockerConfig.current.clientSideRequestTimeOut;
9291

9392
return timedOut || unityWebRequestAsyncOperation.isDone;
9493

9594
});
9695

9796
if (!webRequest.isDone && timedOut)
9897
{
99-
LootLockerLogger.GetForLogLevel(LootLockerLogger.LogLevel.Error)("Exceeded maxTimeOut waiting for a response from " + request.httpMethod + " " + url);
98+
LootLockerLogger.GetForLogLevel(LootLockerLogger.LogLevel.Warning)("Exceeded maxTimeOut waiting for a response from " + request.httpMethod + " " + url);
10099
OnServerResponse?.Invoke(new LootLockerResponse() { hasError = true, statusCode = 408, text = "{\"error\": \"" + request.endpoint + " Timed out.\"}", Error = request.endpoint + " Timed out." });
101100
yield break;
102101
}

Runtime/Game/Resources/LootLockerConfig.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ public enum platformType { Android, iOS, Steam, PlayStationNetwork, Unused }
176176
[HideInInspector] public string playerUrl = UrlProtocol + UrlCore + PlayerUrlAppendage;
177177
[HideInInspector] public string userUrl = UrlProtocol + UrlCore + UserUrlAppendage;
178178
[HideInInspector] public string baseUrl = UrlProtocol + UrlCore;
179+
[HideInInspector] public float clientSideRequestTimeOut = 10f;
179180
public enum DebugLevel { All, ErrorOnly, NormalOnly, Off , AllAsNormal}
180181
public DebugLevel currentDebugLevel = DebugLevel.All;
181182
public bool allowTokenRefresh = true;

0 commit comments

Comments
 (0)