Made update threshold configurable

This commit is contained in:
Risto Lahtela 2021-02-06 08:12:42 +02:00 committed by Risto Lahtela
parent 899d29f2d2
commit 49f6b7708f
4 changed files with 31 additions and 3 deletions

View File

@ -19,6 +19,7 @@ package com.djrapitops.plan.delivery.webserver.resolver.json;
import com.djrapitops.plan.delivery.webserver.cache.DataID;
import com.djrapitops.plan.processing.Processing;
import com.djrapitops.plan.settings.config.PlanConfig;
import com.djrapitops.plan.settings.config.paths.WebserverSettings;
import com.djrapitops.plan.storage.json.JSONStorage;
import com.djrapitops.plan.utilities.UnitSemaphoreAccessLock;
@ -30,7 +31,6 @@ import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.function.Supplier;
@ -74,7 +74,7 @@ public class AsyncJSONResolverService {
}
// No new enough version, let's refresh and send old version of the file
long updateThreshold = TimeUnit.MINUTES.toMillis(1L); // TODO make configurable
long updateThreshold = config.get(WebserverSettings.REDUCED_REFRESH_BARRIER);
// Check if the json is already being created
Future<JSONStorage.StoredJSON> updatedJSON;
@ -125,7 +125,7 @@ public class AsyncJSONResolverService {
}
// No new enough version, let's refresh and send old version of the file
long updateThreshold = TimeUnit.MINUTES.toMillis(1L); // TODO make configurable
long updateThreshold = config.get(WebserverSettings.REDUCED_REFRESH_BARRIER);
// Check if the json is already being created
Future<JSONStorage.StoredJSON> updatedJSON;

View File

@ -43,6 +43,12 @@ public class WebserverSettings {
public static final Setting<Boolean> DISABLED_AUTHENTICATION = new BooleanSetting("Webserver.Security.Disable_authentication");
public static final Setting<String> EXTERNAL_LINK = new StringSetting("Webserver.External_Webserver_address");
public static final Setting<Long> REDUCED_REFRESH_BARRIER = new TimeSetting("Webserver.Cache.Reduced_refresh_barrier");
public static final Setting<Long> INVALIDATE_QUERY_RESULTS = new TimeSetting("Webserver.Cache.Invalidate_query_results_on_disk_after");
public static final Setting<Long> INVALIDATE_DISK_CACHE = new TimeSetting("Webserver.Cache.Invalidate_disk_cache_after");
public static final Setting<Long> INVALIDATE_MEMORY_CACHE = new TimeSetting("Webserver.Cache.Invalidate_memory_cache_after");
public static final Setting<Long> INVALIDATE_FILE_CACHE = new TimeSetting("Webserver.Cache.Invalidate_file_cache_after");
private WebserverSettings() {
/* static variable class */
}

View File

@ -44,6 +44,17 @@ Webserver:
# InternalIP usually does not need to be changed, only change it if you know what you're doing!
# 0.0.0.0 allocates Internal (local) IP automatically for the WebServer.
Internal_IP: 0.0.0.0
Cache:
Reduced_refresh_barrier: 1
Unit: MINUTES
Invalidate_query_results_on_disk_after: 7
Unit: DAYS
Invalidate_disk_cache_after: 1
Unit: DAYS
Invalidate_memory_cache_after: 5
Unit: MINUTES
Invalidate_file_cache_after: 10
Unit: MINUTES
Security:
SSL_certificate:
KeyStore_path: Cert.jks

View File

@ -49,6 +49,17 @@ Webserver:
# InternalIP usually does not need to be changed, only change it if you know what you're doing!
# 0.0.0.0 allocates Internal (local) IP automatically for the WebServer.
Internal_IP: 0.0.0.0
Cache:
Reduced_refresh_barrier: 1
Unit: MINUTES
Invalidate_query_results_on_disk_after: 7
Unit: DAYS
Invalidate_disk_cache_after: 1
Unit: DAYS
Invalidate_memory_cache_after: 5
Unit: MINUTES
Invalidate_file_cache_after: 10
Unit: MINUTES
Security:
SSL_certificate:
KeyStore_path: Cert.jks