Skip to content

Commit

Permalink
Fix issue of duplicate CRSs being generated
Browse files Browse the repository at this point in the history
  • Loading branch information
islathehut committed Apr 2, 2024
1 parent 3d769cc commit ea03e8a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
3 changes: 2 additions & 1 deletion packages/backend/src/nest/storage/storage.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit ea03e8a

Please sign in to comment.