-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add request caching with OkHttp #668
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
skaldarnar
added
Topic: Configuration
Related to configuration design, settings and storage
Type: Enhancement
New features or noticable improvements.
labels
Sep 2, 2021
skaldarnar
commented
Sep 2, 2021
src/test/java/org/terasology/launcher/repositories/JenkinsClientTest.java
Outdated
Show resolved
Hide resolved
skaldarnar
force-pushed
the
feat/caching-with-okhttp
branch
from
March 31, 2022 16:55
91d2056
to
39c88bf
Compare
jdrueckert
reviewed
Mar 31, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add an additional test for the newly introduced request interception/caching logic?
src/main/java/org/terasology/launcher/repositories/JenkinsClient.java
Outdated
Show resolved
Hide resolved
jdrueckert
previously approved these changes
Mar 31, 2022
…between local and CI
jdrueckert
approved these changes
Mar 31, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Topic: Configuration
Related to configuration design, settings and storage
Type: Enhancement
New features or noticable improvements.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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)
)