(fix): Self-healing IDB store
0/3 discussions resolved
40 54 return true; 41 55 } 42 56 57 /** 58 * @returns {Promise<boolean>} 59 */ 60 async consistencyCheck() { 61 const verno = this.db.verno; 62 const schema = this._schemas.find(schema => verno === schema.versionNumber); 63 64 if (!schema) { 65 console.warn(`Consistency check for ${this.db.name}: Schema for version ${verno} not found.`); 66 return false; 67 } 68 69 console.info(`Checking ${this.db.name} consistency...`); - Maintainer
Console log here
74 for (let table of tables) { 75 try { 76 const idbTable = this.db.table(table); 77 await idbTable.count(); 78 } catch (e) { 79 console.info(`Consistency check for ${table} on ${this.db.name}. Got: [${e.name}] ${e.message}`); 80 healthy = false; 81 } 82 83 if (!healthy) { 84 break; 85 } 86 } 87 88 if (healthy) { 89 console.info(`Consistency check for ${this.db.name}: OK!`); - Maintainer
Are we deliberately shipping console.infos to prod for diagnostic purposes? Feels like we should be capturing user logs to a central endpoint (like loggly, but our own or open source)
31 36 /** 32 37 * @returns {Promise<boolean>} 33 38 */ 34 async ready() { 39 ready() { 35 40 if (!this.isReady) { 36 await this.db.open(); - Maintainer
Can this blow up?