Fix server caching not taking platform into account
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0) (push) Successful in 1m0s
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0) (push) Successful in 1m0s
This commit is contained in:
@ -690,9 +690,9 @@ import java.io.Serializable;
|
||||
@RedisHash(value = "server", timeToLive = 60L) // 1 minute (in seconds)
|
||||
public final class CachedMinecraftServer implements Serializable {
|
||||
/**
|
||||
* The hostname of the cached server.
|
||||
* The id of this cached server.
|
||||
*/
|
||||
@Id @NonNull private transient final String hostname;
|
||||
@Id @NonNull private transient final String id;
|
||||
|
||||
/**
|
||||
* The cached server.
|
||||
|
@ -1007,7 +1007,7 @@ public final class MojangService {
|
||||
String lookupHostname = hostname; // The hostname used to lookup the server
|
||||
|
||||
// Check the cache for the server
|
||||
Optional<CachedMinecraftServer> cached = minecraftServerCache.findById(hostname);
|
||||
Optional<CachedMinecraftServer> cached = minecraftServerCache.findById(platform.name() + "-" + hostname);
|
||||
if (cached.isPresent()) { // Respond with the cache if present
|
||||
log.info("Found server in cache: {}", hostname);
|
||||
return cached.get();
|
||||
@ -1021,7 +1021,7 @@ public final class MojangService {
|
||||
}
|
||||
// Build our server model, cache it, and then return it
|
||||
CachedMinecraftServer minecraftServer = new CachedMinecraftServer(
|
||||
lookupHostname,
|
||||
platform.name() + "-" + lookupHostname,
|
||||
platform.getPinger().ping(hostname, port),
|
||||
System.currentTimeMillis()
|
||||
);
|
||||
|
Reference in New Issue
Block a user