From 6ca5deba8bf94ba66d15241400796d27cc79854a Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 23 Oct 2018 21:14:03 -0400 Subject: [PATCH] Don't sleep after profile lookups if not needed Mojang was sleeping even if we had no more requests to go after the current one finished, resulting in 100ms lost per profile lookup --- ...-after-profile-lookups-if-not-needed.patch | 34 +++++++++++++++++++ scripts/importmcdev.sh | 1 + 2 files changed, 35 insertions(+) create mode 100644 Spigot-Server-Patches/Don-t-sleep-after-profile-lookups-if-not-needed.patch diff --git a/Spigot-Server-Patches/Don-t-sleep-after-profile-lookups-if-not-needed.patch b/Spigot-Server-Patches/Don-t-sleep-after-profile-lookups-if-not-needed.patch new file mode 100644 index 0000000000..c1c467f5d3 --- /dev/null +++ b/Spigot-Server-Patches/Don-t-sleep-after-profile-lookups-if-not-needed.patch @@ -0,0 +1,34 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Tue, 23 Oct 2018 20:25:05 -0400 +Subject: [PATCH] Don't sleep after profile lookups if not needed + +Mojang was sleeping even if we had no more requests to go after +the current one finished, resulting in 100ms lost per profile lookup + +diff --git a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java +index 7ac07ac07ac0..7ac07ac07ac0 100644 +--- a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java ++++ b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java +@@ -0,0 +0,0 @@ public class YggdrasilGameProfileRepository implements GameProfileRepository { + } + + final int page = 0; ++ boolean hasRequested = false; // Paper + + for (final List request : Iterables.partition(criteria, ENTRIES_PER_PAGE)) { + int failCount = 0; +@@ -0,0 +0,0 @@ public class YggdrasilGameProfileRepository implements GameProfileRepository { + LOGGER.debug("Couldn't find profile {}", name); + callback.onProfileLookupFailed(new GameProfile(null, name), new ProfileNotFoundException("Server did not find the requested profile")); + } ++ // Paper start ++ if (!hasRequested) { ++ hasRequested = true; ++ continue; ++ } ++ // Paper end + + try { + Thread.sleep(DELAY_BETWEEN_PAGES); +-- \ No newline at end of file diff --git a/scripts/importmcdev.sh b/scripts/importmcdev.sh index e3b5dae872..c6b730e1da 100755 --- a/scripts/importmcdev.sh +++ b/scripts/importmcdev.sh @@ -104,6 +104,7 @@ done # # group # lib # prefix # many files # dont forget \ at end of each line but last +importLibrary com.mojang authlib com/mojang/authlib yggdrasil/YggdrasilGameProfileRepository.java ######################################################## ########################################################