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/7769pull/21833/head
parent
fea9b009b3
commit
16573a6381
|
@ -31,6 +31,7 @@ import {phasedRollOutExpiredForUser} from "./PhasedRollOut";
|
||||||
import Modal from './Modal';
|
import Modal from './Modal';
|
||||||
import {verificationMethods} from 'matrix-js-sdk/lib/crypto';
|
import {verificationMethods} from 'matrix-js-sdk/lib/crypto';
|
||||||
import MatrixClientBackedSettingsHandler from "./settings/handlers/MatrixClientBackedSettingsHandler";
|
import MatrixClientBackedSettingsHandler from "./settings/handlers/MatrixClientBackedSettingsHandler";
|
||||||
|
import * as StorageManager from './utils/StorageManager';
|
||||||
|
|
||||||
interface MatrixClientCreds {
|
interface MatrixClientCreds {
|
||||||
homeserverUrl: string,
|
homeserverUrl: string,
|
||||||
|
@ -94,6 +95,8 @@ class MatrixClientPeg {
|
||||||
}
|
}
|
||||||
|
|
||||||
async start() {
|
async start() {
|
||||||
|
StorageManager.trackStores(this.matrixClient);
|
||||||
|
|
||||||
for (const dbType of ['indexeddb', 'memory']) {
|
for (const dbType of ['indexeddb', 'memory']) {
|
||||||
try {
|
try {
|
||||||
const promise = this.matrixClient.store.startup();
|
const promise = this.matrixClient.store.startup();
|
||||||
|
|
|
@ -147,3 +147,11 @@ async function checkCryptoStore() {
|
||||||
log("Crypto store using memory only");
|
log("Crypto store using memory only");
|
||||||
return { exists, healthy: false };
|
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 New Issue