store hostname instead of query for unique server lookup total
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m38s
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m38s
This commit is contained in:
parent
ba699f5305
commit
8dcde443ee
@ -66,8 +66,6 @@ public class ServerService {
|
|||||||
String key = "%s-%s:%s".formatted(platformName, hostname, port);
|
String key = "%s-%s:%s".formatted(platformName, hostname, port);
|
||||||
log.info("Getting server: {}:{}", hostname, port);
|
log.info("Getting server: {}:{}", hostname, port);
|
||||||
|
|
||||||
((UniqueServerLookupsMetric) metricService.getMetric(UniqueServerLookupsMetric.class)).addLookup(key); // Add the server lookup to the unique server lookups
|
|
||||||
|
|
||||||
// Check if the server is cached
|
// Check if the server is cached
|
||||||
Optional<CachedMinecraftServer> cached = serverCacheRepository.findById(key);
|
Optional<CachedMinecraftServer> cached = serverCacheRepository.findById(key);
|
||||||
if (cached.isPresent() && EnvironmentUtils.isProduction()) {
|
if (cached.isPresent() && EnvironmentUtils.isProduction()) {
|
||||||
@ -102,6 +100,8 @@ public class ServerService {
|
|||||||
((JavaMinecraftServer) server.getServer()).setMojangBlocked(mojangService.isServerBlocked(hostname));
|
((JavaMinecraftServer) server.getServer()).setMojangBlocked(mojangService.isServerBlocked(hostname));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
((UniqueServerLookupsMetric) metricService.getMetric(UniqueServerLookupsMetric.class)).addLookup(key); // Add the server lookup to the unique server lookups
|
||||||
|
|
||||||
log.info("Found server: {}:{}", hostname, port);
|
log.info("Found server: {}:{}", hostname, port);
|
||||||
serverCacheRepository.save(server);
|
serverCacheRepository.save(server);
|
||||||
server.getCache().setCached(false);
|
server.getCache().setCached(false);
|
||||||
|
@ -20,12 +20,12 @@ public class UniqueServerLookupsMetric extends IntegerMetric {
|
|||||||
/**
|
/**
|
||||||
* Adds a lookup to the list of unique lookups.
|
* Adds a lookup to the list of unique lookups.
|
||||||
*
|
*
|
||||||
* @param lookup the query that was used to look up a player
|
* @param hostname the query that was used to look up a player
|
||||||
*/
|
*/
|
||||||
public void addLookup(String lookup) {
|
public void addLookup(String hostname) {
|
||||||
lookup = lookup.toLowerCase();
|
hostname = hostname.toLowerCase();
|
||||||
if (!uniqueLookups.contains(lookup)) {
|
if (!uniqueLookups.contains(hostname)) {
|
||||||
uniqueLookups.add(lookup);
|
uniqueLookups.add(hostname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user