put lock around buildNewOnionPaths since it's called multiple times

pull/1171/head
Ryan Tharp 5 years ago
parent 54ee9e3ad4
commit e2d5d9e793

@ -416,11 +416,10 @@ class LokiSnodeAPI {
}); });
} }
// FIXME: need a lock because it is being called multiple times in parallel
async buildNewOnionPaths() { async buildNewOnionPaths() {
// Note: this function may be called concurrently, so // Note: this function may be called concurrently
// might consider blocking the other calls
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');
@ -497,6 +496,7 @@ class LokiSnodeAPI {
} }
log.info(`Built ${this.onionPaths.length} onion paths`, this.onionPaths); log.info(`Built ${this.onionPaths.length} onion paths`, this.onionPaths);
});
} }
async getRandomSnodeAddress() { async getRandomSnodeAddress() {

Loading…
Cancel
Save