aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
diff options
context:
space:
mode:
authorRoman / Linnea Gräf <roman.graef@gmail.com>2023-02-15 18:50:56 +0100
committerGitHub <noreply@github.com>2023-02-15 18:50:56 +0100
commitd3ca199f904cd72e419c6320eda261f023c71937 (patch)
tree32ea0eb2ceac0e1cb24ab09b21f5e5581f809a39 /src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
parente0ab2af457daf50b838248afbc4110c97a0c8b4a (diff)
downloadnotenoughupdates-d3ca199f904cd72e419c6320eda261f023c71937.tar.gz
notenoughupdates-d3ca199f904cd72e419c6320eda261f023c71937.tar.bz2
notenoughupdates-d3ca199f904cd72e419c6320eda261f023c71937.zip
ApiUtil: Add cache with per request timeout and per class histogram (#592)
* ApiUtil: Add cache with per request timeout and per class histogram * MinionHelper: Only load minion helper data when needed * Api: Make api response processing more async. * Lower cache for /pv to 30 seconds and rename cacheDuration to max age * Disk cache for the API
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
index 17a14d1f..6f8427ae 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java
@@ -42,6 +42,7 @@ import net.minecraft.util.EnumChatFormatting;
import javax.annotation.Nullable;
import java.io.ByteArrayInputStream;
import java.io.IOException;
+import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
@@ -537,6 +538,7 @@ public class ProfileViewer {
manager.apiUtils
.newHypixelApiRequest("player")
.queryArgument("name", nameF)
+ .maxCacheAge(Duration.ofSeconds(30))
.requestJson()
.thenAccept(jsonObject -> {
if (