3
0
mirror of https://github.com/Qortal/qortal.git synced 2025-02-11 17:55:50 +00:00

broader exception handling and added verbosity to the logging

This commit is contained in:
kennycud 2024-10-22 11:30:39 -07:00
parent 3043d1c2cb
commit 85910573a3

View File

@ -46,6 +46,7 @@ public class AtStatesPruner implements Runnable {
repository.saveChanges();
while (!Controller.isStopping()) {
try {
repository.discardChanges();
Thread.sleep(Settings.getInstance().getAtStatesPruneInterval());
@ -75,7 +76,7 @@ public class AtStatesPruner implements Runnable {
if (pruneStartHeight >= upperPruneHeight)
continue;
LOGGER.debug(String.format("Pruning AT states between blocks %d and %d...", pruneStartHeight, upperPruneHeight));
LOGGER.info(String.format("Pruning AT states between blocks %d and %d...", pruneStartHeight, upperPruneHeight));
int numAtStatesPruned = repository.getATRepository().pruneAtStates(pruneStartHeight, upperPruneHeight);
repository.saveChanges();
@ -85,7 +86,7 @@ public class AtStatesPruner implements Runnable {
if (numAtStatesPruned > 0 || numAtStateDataRowsTrimmed > 0) {
final int finalPruneStartHeight = pruneStartHeight;
LOGGER.debug(() -> String.format("Pruned %d AT state%s between blocks %d and %d",
LOGGER.info(() -> String.format("Pruned %d AT state%s between blocks %d and %d",
numAtStatesPruned, (numAtStatesPruned != 1 ? "s" : ""),
finalPruneStartHeight, upperPruneHeight));
} else {
@ -98,7 +99,7 @@ public class AtStatesPruner implements Runnable {
repository.saveChanges();
final int finalPruneStartHeight = pruneStartHeight;
LOGGER.debug(() -> String.format("Bumping AT state base prune height to %d", finalPruneStartHeight));
LOGGER.info(() -> String.format("Bumping AT state base prune height to %d", finalPruneStartHeight));
}
else {
// We've pruned up to the upper prunable height
@ -107,11 +108,12 @@ public class AtStatesPruner implements Runnable {
Thread.sleep(5*60*1000L);
}
}
} catch (Exception e) {
LOGGER.warn("Pruning stopped working. Trying again. Report this error immediately to the developers.", e);
}
} catch (DataException e) {
LOGGER.warn(String.format("Repository issue trying to prune AT states: %s", e.getMessage()));
} catch (InterruptedException e) {
// Time to exit
}
} catch (Exception e) {
LOGGER.error("Pruning is not working! Not trying again. Restart ASAP. Report this error immediately to the developers.", e);
}
}