mirror of
https://github.com/Qortal/qortal.git
synced 2025-02-12 02:05:50 +00:00
broader exception handling and added verbosity to the logging
This commit is contained in:
parent
3043d1c2cb
commit
85910573a3
@ -46,6 +46,7 @@ public class AtStatesPruner implements Runnable {
|
|||||||
repository.saveChanges();
|
repository.saveChanges();
|
||||||
|
|
||||||
while (!Controller.isStopping()) {
|
while (!Controller.isStopping()) {
|
||||||
|
try {
|
||||||
repository.discardChanges();
|
repository.discardChanges();
|
||||||
|
|
||||||
Thread.sleep(Settings.getInstance().getAtStatesPruneInterval());
|
Thread.sleep(Settings.getInstance().getAtStatesPruneInterval());
|
||||||
@ -75,7 +76,7 @@ public class AtStatesPruner implements Runnable {
|
|||||||
if (pruneStartHeight >= upperPruneHeight)
|
if (pruneStartHeight >= upperPruneHeight)
|
||||||
continue;
|
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);
|
int numAtStatesPruned = repository.getATRepository().pruneAtStates(pruneStartHeight, upperPruneHeight);
|
||||||
repository.saveChanges();
|
repository.saveChanges();
|
||||||
@ -85,7 +86,7 @@ public class AtStatesPruner implements Runnable {
|
|||||||
|
|
||||||
if (numAtStatesPruned > 0 || numAtStateDataRowsTrimmed > 0) {
|
if (numAtStatesPruned > 0 || numAtStateDataRowsTrimmed > 0) {
|
||||||
final int finalPruneStartHeight = pruneStartHeight;
|
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" : ""),
|
numAtStatesPruned, (numAtStatesPruned != 1 ? "s" : ""),
|
||||||
finalPruneStartHeight, upperPruneHeight));
|
finalPruneStartHeight, upperPruneHeight));
|
||||||
} else {
|
} else {
|
||||||
@ -98,7 +99,7 @@ public class AtStatesPruner implements Runnable {
|
|||||||
repository.saveChanges();
|
repository.saveChanges();
|
||||||
|
|
||||||
final int finalPruneStartHeight = pruneStartHeight;
|
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 {
|
else {
|
||||||
// We've pruned up to the upper prunable height
|
// We've pruned up to the upper prunable height
|
||||||
@ -107,11 +108,12 @@ public class AtStatesPruner implements Runnable {
|
|||||||
Thread.sleep(5*60*1000L);
|
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 (Exception e) {
|
||||||
} catch (InterruptedException e) {
|
LOGGER.error("Pruning is not working! Not trying again. Restart ASAP. Report this error immediately to the developers.", e);
|
||||||
// Time to exit
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user