mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-15 05:41:51 +08:00
Made transaction wait delay configurable
This commit is contained in:
parent
b9ec70619a
commit
233a930c9c
@ -28,6 +28,7 @@ import com.djrapitops.plan.db.access.transactions.init.OperationCriticalTransact
|
||||
import com.djrapitops.plan.db.patches.*;
|
||||
import com.djrapitops.plan.system.locale.Locale;
|
||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.system.settings.paths.TimeSettings;
|
||||
import com.djrapitops.plan.utilities.java.ThrowableUtils;
|
||||
import com.djrapitops.plugin.api.TimeAmount;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
@ -112,8 +113,14 @@ public abstract class SQLDB extends AbstractDatabase {
|
||||
}
|
||||
transactionExecutor.shutdown();
|
||||
try {
|
||||
if (!transactionExecutor.awaitTermination(20L, TimeUnit.SECONDS)) {
|
||||
return transactionExecutor.shutdownNow();
|
||||
Long waitMs = config.get(TimeSettings.DB_TRANSACTION_FINISH_WAIT_DELAY);
|
||||
if (!transactionExecutor.awaitTermination(waitMs, TimeUnit.MILLISECONDS)) {
|
||||
List<Runnable> unfinished = transactionExecutor.shutdownNow();
|
||||
int unfinishedCount = unfinished.size();
|
||||
if (unfinishedCount > 0) {
|
||||
logger.warn(unfinishedCount + " unfinished database transactions were not executed.");
|
||||
}
|
||||
return unfinished;
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
|
@ -148,4 +148,9 @@ public abstract class Transaction {
|
||||
protected UUID getServerUUID() {
|
||||
return db.getServerUUIDSupplier().get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + (success ? " (finished)" : "");
|
||||
}
|
||||
}
|
@ -31,6 +31,7 @@ public class TimeSettings {
|
||||
public static final Setting<Boolean> USE_SERVER_TIME = new BooleanSetting("Time.Use_server_timezone");
|
||||
public static final Setting<Long> PING_SERVER_ENABLE_DELAY = new TimeSetting("Time.Delays.Ping_server_enable_delay");
|
||||
public static final Setting<Long> PING_PLAYER_LOGIN_DELAY = new TimeSetting("Time.Delays.Ping_player_join_delay");
|
||||
public static final Setting<Long> DB_TRANSACTION_FINISH_WAIT_DELAY = new TimeSetting("Time.Delays.Wait_for_DB_Transactions_on_disable");
|
||||
public static final Setting<Long> AFK_THRESHOLD = new TimeSetting("Time.Thresholds.AFK_threshold");
|
||||
public static final Setting<Integer> ACTIVE_LOGIN_THRESHOLD = new IntegerSetting("Time.Thresholds.Activity_index.Login_threshold", Setting::timeValidator);
|
||||
public static final Setting<Long> ACTIVE_PLAY_THRESHOLD = new TimeSetting("Time.Thresholds.Activity_index.Playtime_threshold");
|
||||
|
@ -70,6 +70,8 @@ Time:
|
||||
Unit: SECONDS
|
||||
Ping_player_join_delay: 30
|
||||
Unit: SECONDS
|
||||
Wait_for_DB_Transactions_on_disable:
|
||||
Unit: SECONDS
|
||||
Thresholds:
|
||||
# How long player needs to be idle until Plan considers them AFK
|
||||
AFK_threshold: 3
|
||||
|
@ -75,6 +75,8 @@ Time:
|
||||
Unit: SECONDS
|
||||
Ping_player_join_delay: 30
|
||||
Unit: SECONDS
|
||||
Wait_for_DB_Transactions_on_disable: 20
|
||||
Unit: SECONDS
|
||||
Thresholds:
|
||||
# How long player needs to be idle until Plan considers them AFK
|
||||
AFK_threshold: 3
|
||||
|
Loading…
Reference in New Issue
Block a user