Problem Statement
In EventQueue.cs's FlushCoroutine, the Application.internetReachability == NetworkReachability.NotReachable check does not actually always determine whether internet connection (especially to a specific server) is available and working.
On top of this first cheap check, I suggest to have another cheap check following it which just pings against any relevant servers, before running NetworkClient's SendBatch logic. If check fails, apply same logic as the internetReachability check.
Solution Brainstorm
You could use Task or Coroutine (see link below for simple example using coroutine). UniTask is great for this kind of stuff too but I don't think you guys are using it.
https://stackoverflow.com/a/57553685
See the code below for UniTask implementation based on the link above
public static async UniTask<bool> CheckInternetConnection(CancellationToken cancellationToken = default)
{
const string echoServer = "http://google.com";
using (var request = UnityWebRequest.Head(echoServer))
{
request.timeout = 5;
try
{
await request.SendWebRequest().WithCancellation(cancellationToken);
}
catch (UnityWebRequestException)
{
return false;
}
return (request.result != UnityWebRequest.Result.ConnectionError) && (request.result != UnityWebRequest.Result.ProtocolError) && request.responseCode == 200;
}
}
Problem Statement
In EventQueue.cs's FlushCoroutine, the Application.internetReachability == NetworkReachability.NotReachable check does not actually always determine whether internet connection (especially to a specific server) is available and working.
On top of this first cheap check, I suggest to have another cheap check following it which just pings against any relevant servers, before running NetworkClient's SendBatch logic. If check fails, apply same logic as the internetReachability check.
Solution Brainstorm
You could use Task or Coroutine (see link below for simple example using coroutine). UniTask is great for this kind of stuff too but I don't think you guys are using it.
https://stackoverflow.com/a/57553685
See the code below for UniTask implementation based on the link above