From ea03e8a1d1b0da9079ccd1d688b9a604fe2c3296 Mon Sep 17 00:00:00 2001 From: Isla Koenigsknecht Date: Tue, 2 Apr 2024 10:20:39 -0400 Subject: [PATCH] Fix issue of duplicate CRSs being generated --- .../storage/certifacteRequests/certificatesRequestsStore.ts | 1 + packages/backend/src/nest/storage/storage.service.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/nest/storage/certifacteRequests/certificatesRequestsStore.ts b/packages/backend/src/nest/storage/certifacteRequests/certificatesRequestsStore.ts index 5c30871d59..ce32cbe387 100644 --- a/packages/backend/src/nest/storage/certifacteRequests/certificatesRequestsStore.ts +++ b/packages/backend/src/nest/storage/certifacteRequests/certificatesRequestsStore.ts @@ -29,6 +29,7 @@ export class CertificatesRequestsStore extends EventEmitter { write: ['*'], }, }) + await this.store.load() this.store.events.on('write', async (_address, entry) => { this.logger('Added CSR to database') diff --git a/packages/backend/src/nest/storage/storage.service.ts b/packages/backend/src/nest/storage/storage.service.ts index 53988be1ff..a15388082c 100644 --- a/packages/backend/src/nest/storage/storage.service.ts +++ b/packages/backend/src/nest/storage/storage.service.ts @@ -314,8 +314,9 @@ export class StorageService extends EventEmitter { public async updatePeersList() { const users = this.getAllUsers() - const peers = users.map(peer => createLibp2pAddress(peer.onionAddress, peer.peerId)) + const peers = Array.from(new Set(users.map(peer => createLibp2pAddress(peer.onionAddress, peer.peerId)))) console.log('updatePeersList, peers count:', peers.length) + const community = await this.localDbService.get(LocalDBKeys.COMMUNITY) const sortedPeers = await this.localDbService.getSortedPeers(peers) if (sortedPeers.length > 0) {