Mise à jour de GitLab prévue ce samedi 23 octobre 2021 à partir de 9h00 CET

Commit 72ed6c5e authored by Gilles Filippini's avatar Gilles Filippini Committed by pini
Browse files

fix(sync): when called with --only-peers

When 'sync' is called with option '--only-peers', the path to function
'RemoteSynchronizer.getPeers()' is not the same as the default.

In this case we need to ensure that 'init()' was properly called and
proceed without a watcher.
parent d01f2505
Pipeline #12291 failed with stages
in 60 minutes and 14 seconds
......@@ -382,16 +382,23 @@ export class RemoteSynchronizer extends AbstractSynchronizer {
}
async syncPeers(fullSync: boolean, to?: number): Promise<void> {
if (!this.node) {
await this.init();
}
const peers = await this.node.getPeers();
for (let i = 0; i < peers.length; i++) {
const peer = PeerDTO.fromJSONObject(peers[i]);
this.watcher.writeStatus("Peer " + peer.pubkey);
this.watcher.peersPercent(Math.ceil((i / peers.length) * 100));
if (this.watcher) {
this.watcher.writeStatus("Peer " + peer.pubkey);
this.watcher.peersPercent(Math.ceil((i / peers.length) * 100));
}
try {
await this.PeeringService.submitP(DBPeer.fromPeerDTO(peer));
} catch (e) {}
}
this.watcher.peersPercent(100);
if (this.watcher) {
this.watcher.peersPercent(100);
}
}
async syncSandbox(): Promise<void> {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment