Skip to content
Extraits de code Groupes Projets
Valider 99f3aa0d rédigé par Christian Paul's avatar Christian Paul
Parcourir les fichiers

Add countEntries

parent 85295849
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -98,6 +98,22 @@ export class DbRoomStore { ...@@ -98,6 +98,22 @@ export class DbRoomStore {
this.entriesMatrixIdCache = new TimedCache(ENTRY_CACHE_LIMETIME); this.entriesMatrixIdCache = new TimedCache(ENTRY_CACHE_LIMETIME);
} }
/**
* Returns the number of bridged room pairs. Every connection between a
* Matrix room and a remote room counts as one pair.
* @returns {number} The amount of room pairs as an integer
*/
public async countEntries() {
const row = (await this.db.Get("SELECT COUNT(*) FROM room_entries")) || {};
if (typeof row.count !== "number") {
log.error("Failed to count room entries");
throw Error("Failed to count room entries");
}
return row.count;
}
public async upsertEntry(entry: IRoomStoreEntry) { public async upsertEntry(entry: IRoomStoreEntry) {
const promises: Promise<void>[] = []; const promises: Promise<void>[] = [];
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter