Repeat bootstrap attempts (#380)
* Repeatedly attempt to bootstrap watcher until it happens. * Get rid of first request bootstrap, watcher polls now.
This commit is contained in:
parent
ad844263dd
commit
0e979dc77c
|
@ -1,14 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""Create an application instance."""
|
||||
from grant.app import create_app
|
||||
from grant.blockchain.bootstrap import send_bootstrap_data
|
||||
|
||||
app = create_app()
|
||||
|
||||
|
||||
@app.before_first_request
|
||||
def bootstrap_watcher():
|
||||
try:
|
||||
send_bootstrap_data()
|
||||
except:
|
||||
print('Failed to send bootstrap data, watcher must be offline')
|
||||
|
|
|
@ -16,7 +16,7 @@ async function start() {
|
|||
log.info("============== Starting services ==============");
|
||||
await initNode();
|
||||
await RestServer.start();
|
||||
await Webhooks.start();
|
||||
Webhooks.start();
|
||||
log.info("===============================================");
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,13 @@ const MIN_BLOCK_CONF = parseInt(env.MINIMUM_BLOCK_CONFIRMATIONS, 10);
|
|||
export async function start() {
|
||||
initScan();
|
||||
initNotifiers();
|
||||
await requestBootstrap();
|
||||
|
||||
let { startingBlockHeight } = store.getState();
|
||||
while (!startingBlockHeight) {
|
||||
await requestBootstrap();
|
||||
await sleep(10000);
|
||||
startingBlockHeight = store.getState().startingBlockHeight;
|
||||
}
|
||||
}
|
||||
|
||||
export function exit() {
|
||||
|
|
Loading…
Reference in New Issue