Fixed more issues that could cause transactions to be held open.

This commit is contained in:
CalDescent 2021-10-02 13:05:16 +01:00
parent ca7f42c409
commit c4d7335fdd
4 changed files with 8 additions and 3 deletions

View File

@ -94,6 +94,7 @@ public class AtStatesPruner implements Runnable {
else {
// We've pruned up to the upper prunable height
// Back off for a while to save CPU for syncing
repository.discardChanges();
Thread.sleep(5*60*1000L);
}
}

View File

@ -25,18 +25,19 @@ public class BlockArchiver implements Runnable {
}
try (final Repository repository = RepositoryManager.getRepository()) {
// Don't even start building until initial rush has ended
Thread.sleep(INITIAL_SLEEP_PERIOD);
int startHeight = repository.getBlockArchiveRepository().getBlockArchiveHeight();
// Don't attempt to archive if we have no ATStatesHeightIndex, as it will be too slow
boolean hasAtStatesHeightIndex = repository.getATRepository().hasAtStatesHeightIndex();
if (!hasAtStatesHeightIndex) {
LOGGER.info("Unable to start block archiver due to missing ATStatesHeightIndex. Bootstrapping is recommended.");
repository.discardChanges();
return;
}
// Don't even start building until initial rush has ended
Thread.sleep(INITIAL_SLEEP_PERIOD);
LOGGER.info("Starting block archiver...");
while (!Controller.isStopping()) {
@ -91,6 +92,7 @@ public class BlockArchiver implements Runnable {
// that a bootstrap or re-sync is needed. Try again every minute until then.
LOGGER.info("Error: block not found when building archive. If this error persists, " +
"a bootstrap or re-sync may be needed.");
repository.discardChanges();
Thread.sleep( 60 * 1000L); // 1 minute
break;
}

View File

@ -99,6 +99,7 @@ public class BlockPruner implements Runnable {
else {
// We've pruned up to the upper prunable height
// Back off for a while to save CPU for syncing
repository.discardChanges();
Thread.sleep(10*60*1000L);
}
}

View File

@ -317,6 +317,7 @@ public class Bootstrap {
LOGGER.info("Retrying in 5 minutes");
try {
repository.discardChanges();
Thread.sleep(5 * 60 * 1000L);
} catch (InterruptedException e2) {
break;