diff --git a/app/modules/crawler/lib/sync.ts b/app/modules/crawler/lib/sync.ts index 99598fa62d8719768e30e4f328a1ea5c1d396494..77b3c5640495e98260aba7dde1fd2fd069bc9688 100644 --- a/app/modules/crawler/lib/sync.ts +++ b/app/modules/crawler/lib/sync.ts @@ -143,7 +143,7 @@ export class Synchroniser extends stream.Duplex { !cautious, this.watcher) - downloader.start() + const startp = downloader.start() let lastPullBlock:BlockDTO|null = null; let syncStrategy = this.syncStrategy @@ -242,7 +242,10 @@ export class Synchroniser extends stream.Duplex { })(this.server, this.watcher, this.dal, this.BlockchainService) const logInterval = setInterval(() => this.logRemaining(to), EVAL_REMAINING_INTERVAL); - await dao.pull(this.conf, this.logger) + await Promise.all([ + dao.pull(this.conf, this.logger), + await startp // In case of errors, will stop the process + ]) // Finished blocks this.watcher.downloadPercent(100.0);