forked from Qortal/qortal
Exponentially backoff when bootstrapping fails, to reduce bandwidth
The retry interval starts at 5 minutes and doubles with each failure.
This commit is contained in:
parent
0135f25b9d
commit
71f802ef35
@ -32,6 +32,8 @@ public class Bootstrap {
|
|||||||
|
|
||||||
private Repository repository;
|
private Repository repository;
|
||||||
|
|
||||||
|
private int retryMinutes = 5;
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(Bootstrap.class);
|
private static final Logger LOGGER = LogManager.getLogger(Bootstrap.class);
|
||||||
|
|
||||||
/** The maximum number of untrimmed blocks allowed to be included in a bootstrap, beyond the trim threshold */
|
/** The maximum number of untrimmed blocks allowed to be included in a bootstrap, beyond the trim threshold */
|
||||||
@ -312,8 +314,9 @@ public class Bootstrap {
|
|||||||
|
|
||||||
} catch (DataException e) {
|
} catch (DataException e) {
|
||||||
LOGGER.info("Bootstrap import failed: {}", e.getMessage());
|
LOGGER.info("Bootstrap import failed: {}", e.getMessage());
|
||||||
this.updateStatus("Bootstrapping failed. Retrying in 5 minutes");
|
this.updateStatus(String.format("Bootstrapping failed. Retrying in %d minutes...", retryMinutes));
|
||||||
Thread.sleep(5 * 60 * 1000L);
|
Thread.sleep(retryMinutes * 60 * 1000L);
|
||||||
|
retryMinutes *= 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user