Open jknotten opened 2 years ago
Further to this, the onQuit can take a very long time (in the order of minutes) if the network is particularly flaky.
I have put together some changes. If there is interest, I can try to make a pull request so that we can get some form of this integrated into the main line.
The changes that I made were:
Testing:
On Windows, a useful tool is clumsy . I have tested with a lay of 3 seconds using the preset "all receiving packets".
On Mac OS X, a useful tool is Network Link Conditioner (part of Additional Tools for Xcode, a separate download) with a custom network profile (DNS Delay of 10000ms, Bandwidth 1kbps, Packets Dropped 99.9% and Delay 5s).
When the user quits the game, there is a pause while the last few events are processed (including the close session event). This is taking around 2 seconds on average. It's long enough that the spinning beach ball in Mac OS X and the circular wait icon in Windows shows, which gives an impression of unresponsiveness.
It would be nicer if the exit from the application was more immediate. How about if the end session event is posted next time the game runs? The analytics backend could make an assumption that the session has ended if no events have been posted for a certain amount of time, and then make it more accurate when the actual event data is eventually sent.