Skip to content
Snippets Groups Projects
Commit eae94e0f authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[fix] sync: let Duniter exit if an error occur during blocks retrieval

parent 2bb8f811
No related branches found
No related tags found
No related merge requests found
...@@ -143,7 +143,7 @@ export class Synchroniser extends stream.Duplex { ...@@ -143,7 +143,7 @@ export class Synchroniser extends stream.Duplex {
!cautious, !cautious,
this.watcher) this.watcher)
downloader.start() const startp = downloader.start()
let lastPullBlock:BlockDTO|null = null; let lastPullBlock:BlockDTO|null = null;
let syncStrategy = this.syncStrategy let syncStrategy = this.syncStrategy
...@@ -242,7 +242,10 @@ export class Synchroniser extends stream.Duplex { ...@@ -242,7 +242,10 @@ export class Synchroniser extends stream.Duplex {
})(this.server, this.watcher, this.dal, this.BlockchainService) })(this.server, this.watcher, this.dal, this.BlockchainService)
const logInterval = setInterval(() => this.logRemaining(to), EVAL_REMAINING_INTERVAL); 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 // Finished blocks
this.watcher.downloadPercent(100.0); this.watcher.downloadPercent(100.0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment