fix the fixy
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m59s
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Successful in 1m59s
This commit is contained in:
@ -6,6 +6,7 @@ import com.influxdb.spring.influx.InfluxDB2AutoConfiguration;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import xyz.mcutils.backend.common.EnvironmentUtils;
|
||||
import xyz.mcutils.backend.common.Timer;
|
||||
import xyz.mcutils.backend.config.Config;
|
||||
import xyz.mcutils.backend.repository.mongo.MetricsRepository;
|
||||
@ -56,7 +57,7 @@ public class MetricService {
|
||||
collectorEnabled.put(metric, metric.isCollector());
|
||||
}
|
||||
|
||||
if (Config.INSTANCE.isProduction()) {
|
||||
if (EnvironmentUtils.isProduction()) {
|
||||
// Load the metrics from Redis
|
||||
loadMetrics();
|
||||
|
||||
|
@ -15,6 +15,7 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import xyz.mcutils.backend.Main;
|
||||
import xyz.mcutils.backend.common.Endpoint;
|
||||
import xyz.mcutils.backend.common.EnvironmentUtils;
|
||||
import xyz.mcutils.backend.common.ExpiringSet;
|
||||
import xyz.mcutils.backend.common.WebRequest;
|
||||
import xyz.mcutils.backend.config.Config;
|
||||
@ -190,7 +191,7 @@ public class MojangService {
|
||||
public CachedEndpointStatus getMojangApiStatus() {
|
||||
log.info("Getting Mojang API status");
|
||||
Optional<CachedEndpointStatus> endpointStatus = mojangEndpointStatusRepository.findById(MOJANG_ENDPOINT_STATUS_KEY);
|
||||
if (endpointStatus.isPresent() && Config.INSTANCE.isProduction()) {
|
||||
if (endpointStatus.isPresent() && EnvironmentUtils.isProduction()) {
|
||||
log.info("Got cached Mojang API status");
|
||||
return endpointStatus.get();
|
||||
}
|
||||
|
@ -3,10 +3,7 @@ package xyz.mcutils.backend.service;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import xyz.mcutils.backend.common.ImageUtils;
|
||||
import xyz.mcutils.backend.common.PlayerUtils;
|
||||
import xyz.mcutils.backend.common.Tuple;
|
||||
import xyz.mcutils.backend.common.UUIDUtils;
|
||||
import xyz.mcutils.backend.common.*;
|
||||
import xyz.mcutils.backend.config.Config;
|
||||
import xyz.mcutils.backend.exception.impl.BadRequestException;
|
||||
import xyz.mcutils.backend.exception.impl.MojangAPIRateLimitException;
|
||||
@ -67,7 +64,7 @@ public class PlayerService {
|
||||
((UniquePlayerLookupsMetric) metricService.getMetric(UniquePlayerLookupsMetric.class)).addLookup(id); // Add the lookup to the unique player lookups
|
||||
|
||||
Optional<CachedPlayer> cachedPlayer = playerCacheRepository.findById(uuid);
|
||||
if (cachedPlayer.isPresent() && Config.INSTANCE.isProduction()) { // Return the cached player if it exists
|
||||
if (cachedPlayer.isPresent() && EnvironmentUtils.isProduction()) { // Return the cached player if it exists
|
||||
log.info("Player {} is cached", id);
|
||||
return cachedPlayer.get();
|
||||
}
|
||||
@ -107,7 +104,7 @@ public class PlayerService {
|
||||
log.info("Getting UUID from username: {}", username);
|
||||
String id = username.toUpperCase();
|
||||
Optional<CachedPlayerName> cachedPlayerName = playerNameCacheRepository.findById(id);
|
||||
if (cachedPlayerName.isPresent() && Config.INSTANCE.isProduction()) {
|
||||
if (cachedPlayerName.isPresent() && EnvironmentUtils.isProduction()) {
|
||||
return cachedPlayerName.get();
|
||||
}
|
||||
try {
|
||||
@ -157,7 +154,7 @@ public class PlayerService {
|
||||
Optional<CachedPlayerSkinPart> cache = playerSkinPartCacheRepository.findById(key);
|
||||
|
||||
// The skin part is cached
|
||||
if (cache.isPresent() && Config.INSTANCE.isProduction()) {
|
||||
if (cache.isPresent() && EnvironmentUtils.isProduction()) {
|
||||
log.info("Skin part {} for player {} is cached", name, player.getUniqueId());
|
||||
return cache.get();
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import xyz.mcutils.backend.common.DNSUtils;
|
||||
import xyz.mcutils.backend.common.EnumUtils;
|
||||
import xyz.mcutils.backend.common.EnvironmentUtils;
|
||||
import xyz.mcutils.backend.config.Config;
|
||||
import xyz.mcutils.backend.exception.impl.BadRequestException;
|
||||
import xyz.mcutils.backend.exception.impl.ResourceNotFoundException;
|
||||
@ -69,7 +70,7 @@ public class ServerService {
|
||||
|
||||
// Check if the server is cached
|
||||
Optional<CachedMinecraftServer> cached = serverCacheRepository.findById(key);
|
||||
if (cached.isPresent() && Config.INSTANCE.isProduction()) {
|
||||
if (cached.isPresent() && EnvironmentUtils.isProduction()) {
|
||||
log.info("Server {}:{} is cached", hostname, port);
|
||||
return cached.get();
|
||||
}
|
||||
|
Reference in New Issue
Block a user