MovingBlocks / TerasologyLauncher

Terasology Launcher is the official launcher for the open source game Terasology.
http://terasology.org/
Apache License 2.0
154 stars 76 forks source link

feat: add request caching with OkHttp #668

Closed skaldarnar closed 2 years ago

skaldarnar commented 3 years ago

Contains

I was thinking about using a different HTTP client, especially one that brings some caching functionality with it. Motivated by the recent changes using Java's HttpClient I took a shot at OkHttp.

For a start, this uses an OkHttpClient with caching for fetching game releases (the metadata) from Jenkins and Github (the Github library we use works with OkHttp). To actually cache files from our Jenkins I had to "tweak" the cache control headers a bit.

The local cache files are written to the launcher's cache directy (default on Linux ~/.terasologylauncher/cache). The cache size is limited to 10MB (for now).

For me this change reduced the startup time from ~8 seconds down to 3-4 seconds.

How to test

Ensure that all tests are still passing (gradlew test) and double-check that the tests still test what they are supposed to be testing.

For manual testing:

jdrueckert commented 3 years ago

Launcher improvements