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:
William O'Beirne 2019-03-14 23:21:28 -04:00 committed by Daniel Ternyak
parent ad844263dd
commit 0e979dc77c
3 changed files with 8 additions and 11 deletions

View File

@ -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')

View File

@ -16,7 +16,7 @@ async function start() {
log.info("============== Starting services ==============");
await initNode();
await RestServer.start();
await Webhooks.start();
Webhooks.start();
log.info("===============================================");
}

View File

@ -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() {