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:
ensure that the cache directory is empty
start the launcher normally
[X] check that the cache directoy is filled when fetching game releases
restart the launcher
[X] check that (some) requests are served from cache (logged with suffix (cached))
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:
(cached)
)