Track store failures after startup
This watches the `IndexedDBStore` in case it degrades. If it does, we track this in analytics so we can observe how often it happens in the field. Should help track errors like https://github.com/vector-im/riot-web/issues/7769
This commit is contained in:
parent
fea9b009b3
commit
16573a6381
2 changed files with 11 additions and 0 deletions
|
@ -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();
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue