forked from Qortal/qortal
Retry scheduled repository maintenance up to 5 times, as it's common for it to timeout waiting for the repository. Subsequent retries normally succeed.
This commit is contained in:
parent
d98678fc5f
commit
ae64be4802
@ -573,15 +573,20 @@ public class Controller extends Thread {
|
||||
MessageType.INFO);
|
||||
|
||||
LOGGER.info("Starting scheduled repository maintenance. This can take a while...");
|
||||
try (final Repository repository = RepositoryManager.getRepository()) {
|
||||
int attempts = 0;
|
||||
while (attempts <= 5) {
|
||||
try (final Repository repository = RepositoryManager.getRepository()) {
|
||||
attempts++;
|
||||
|
||||
// Timeout if the database isn't ready for maintenance after 60 seconds
|
||||
long timeout = 60 * 1000L;
|
||||
repository.performPeriodicMaintenance(timeout);
|
||||
// Timeout if the database isn't ready for maintenance after 60 seconds
|
||||
long timeout = 60 * 1000L;
|
||||
repository.performPeriodicMaintenance(timeout);
|
||||
|
||||
LOGGER.info("Scheduled repository maintenance completed");
|
||||
} catch (DataException | TimeoutException e) {
|
||||
LOGGER.error("Scheduled repository maintenance failed", e);
|
||||
LOGGER.info("Scheduled repository maintenance completed");
|
||||
break;
|
||||
} catch (DataException | TimeoutException e) {
|
||||
LOGGER.info("Scheduled repository maintenance failed. Retrying up to 5 times...", e);
|
||||
}
|
||||
}
|
||||
|
||||
// Get a new random interval
|
||||
|
Loading…
x
Reference in New Issue
Block a user