Log unexpected ml db errors to sentry
This commit is contained in:
parent
5b7c8a2cf7
commit
69cdf5179f
|
@ -16,6 +16,7 @@ import { Config } from 'types/common/config';
|
||||||
import { Face, MlFileData, MLLibraryData, Person } from 'types/machineLearning';
|
import { Face, MlFileData, MLLibraryData, Person } from 'types/machineLearning';
|
||||||
import { IndexStatus } from 'types/machineLearning/ui';
|
import { IndexStatus } from 'types/machineLearning/ui';
|
||||||
import { runningInBrowser } from 'utils/common';
|
import { runningInBrowser } from 'utils/common';
|
||||||
|
import { logError } from 'utils/sentry';
|
||||||
|
|
||||||
export const ML_SYNC_JOB_CONFIG_NAME = 'ml-sync-job';
|
export const ML_SYNC_JOB_CONFIG_NAME = 'ml-sync-job';
|
||||||
export const ML_SYNC_CONFIG_NAME = 'ml-sync';
|
export const ML_SYNC_CONFIG_NAME = 'ml-sync';
|
||||||
|
@ -61,10 +62,22 @@ class MLIDbStorage {
|
||||||
const mlIDbStorage = this;
|
const mlIDbStorage = this;
|
||||||
return openDB<MLDb>(MLDATA_DB_NAME, 3, {
|
return openDB<MLDb>(MLDATA_DB_NAME, 3, {
|
||||||
async terminated() {
|
async terminated() {
|
||||||
console.log('Indexed DB terminated');
|
console.error('ML Indexed DB terminated');
|
||||||
|
logError(new Error(), 'ML Indexed DB terminated');
|
||||||
mlIDbStorage._db = undefined;
|
mlIDbStorage._db = undefined;
|
||||||
|
// TODO: remove if there is chance of this going into recursion in some case
|
||||||
await mlIDbStorage.db;
|
await mlIDbStorage.db;
|
||||||
},
|
},
|
||||||
|
blocked() {
|
||||||
|
// TODO: make sure we dont allow multiple tabs of app
|
||||||
|
console.error('ML Indexed DB blocked');
|
||||||
|
logError(new Error(), 'ML Indexed DB blocked');
|
||||||
|
},
|
||||||
|
blocking() {
|
||||||
|
// TODO: make sure we dont allow multiple tabs of app
|
||||||
|
console.error('ML Indexed DB blocking');
|
||||||
|
logError(new Error(), 'ML Indexed DB blocking');
|
||||||
|
},
|
||||||
async upgrade(db, oldVersion, newVersion, tx) {
|
async upgrade(db, oldVersion, newVersion, tx) {
|
||||||
if (oldVersion < 1) {
|
if (oldVersion < 1) {
|
||||||
const filesStore = db.createObjectStore('files', {
|
const filesStore = db.createObjectStore('files', {
|
||||||
|
|
Loading…
Reference in a new issue