move internal buildNewOnionPaths function into buildNewOnionPathsWorker per review

pull/1171/head
Ryan Tharp 5 years ago
parent db36067503
commit a905703cb4

@ -408,10 +408,7 @@ class LokiSnodeAPI {
}); });
} }
async buildNewOnionPaths() { async buildNewOnionPathsWorker() {
// Note: this function may be called concurrently
return primitives.allowOnlyOneAtATime('buildNewOnionPaths', async () => {
const _ = window.Lodash; const _ = window.Lodash;
log.info('LokiSnodeAPI::buildNewOnionPaths - building new onion paths'); log.info('LokiSnodeAPI::buildNewOnionPaths - building new onion paths');
@ -489,7 +486,11 @@ class LokiSnodeAPI {
} }
log.info(`Built ${this.onionPaths.length} onion paths`, this.onionPaths); log.info(`Built ${this.onionPaths.length} onion paths`, this.onionPaths);
}); }
async buildNewOnionPaths() {
// this function may be called concurrently make sure we only have one inflight
return primitives.allowOnlyOneAtATime('buildNewOnionPaths', this.buildNewOnionPathsWorker);
} }
async getRandomSnodeAddress() { async getRandomSnodeAddress() {

Loading…
Cancel
Save