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

Commit a3f7abd4 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[fix] dao: peers collection could contain empty peers

parent 812d32c8
......@@ -8,6 +8,11 @@ export class LokiPeer extends LokiCollectionManager<DBPeer> implements PeerDAO {
super(loki, 'peer', ['pubkey'])
}
async init(): Promise<void> {
await super.init();
this.cleanEmptyPeers()
}
cleanCache(): void {
}
......@@ -84,6 +89,14 @@ export class LokiPeer extends LokiCollectionManager<DBPeer> implements PeerDAO {
.remove()
}
async cleanEmptyPeers(): Promise<void> {
this.collection
.chain()
.find({})
.where(p => !p.endpoints || !p.endpoints.length)
.remove()
}
async getPeersWithEndpointsLike(ep: string): Promise<DBPeer[]> {
return this.collection
.chain()
......
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