diff --git a/src/MatrixClientPeg.js b/src/MatrixClientPeg.js index 94a016d207..ccdd48f41b 100644 --- a/src/MatrixClientPeg.js +++ b/src/MatrixClientPeg.js @@ -31,6 +31,7 @@ import {phasedRollOutExpiredForUser} from "./PhasedRollOut"; import Modal from './Modal'; import {verificationMethods} from 'matrix-js-sdk/lib/crypto'; import MatrixClientBackedSettingsHandler from "./settings/handlers/MatrixClientBackedSettingsHandler"; +import * as StorageManager from './utils/StorageManager'; interface MatrixClientCreds { homeserverUrl: string, @@ -94,6 +95,8 @@ class MatrixClientPeg { } async start() { + StorageManager.trackStores(this.matrixClient); + for (const dbType of ['indexeddb', 'memory']) { try { const promise = this.matrixClient.store.startup(); diff --git a/src/utils/StorageManager.js b/src/utils/StorageManager.js index ad75c0391e..1c0931273b 100644 --- a/src/utils/StorageManager.js +++ b/src/utils/StorageManager.js @@ -147,3 +147,11 @@ async function checkCryptoStore() { log("Crypto store using memory only"); return { exists, healthy: false }; } + +export function trackStores(client) { + if (client.store && client.store.on) { + client.store.on("degraded", () => { + track("Sync store using IndexedDB degraded to memory"); + }); + } +}