sync checks for note_contents

This commit is contained in:
zadam 2019-04-13 10:13:47 +02:00
parent 27f74489fd
commit be378f71b0
2 changed files with 7 additions and 4 deletions

View File

@ -430,6 +430,7 @@ async function runSyncRowChecks(entityName, key) {
async function findSyncRowsIssues() { async function findSyncRowsIssues() {
await runSyncRowChecks("notes", "noteId"); await runSyncRowChecks("notes", "noteId");
await runSyncRowChecks("note_contents", "noteId");
await runSyncRowChecks("note_revisions", "noteRevisionId"); await runSyncRowChecks("note_revisions", "noteRevisionId");
await runSyncRowChecks("branches", "branchId"); await runSyncRowChecks("branches", "branchId");
await runSyncRowChecks("recent_notes", "branchId"); await runSyncRowChecks("recent_notes", "branchId");

View File

@ -49,7 +49,11 @@ async function sync() {
catch (e) { catch (e) {
proxyToggle = !proxyToggle; proxyToggle = !proxyToggle;
if (e.message && (e.message.includes('ECONNREFUSED') || e.message.includes('ERR_CONNECTION_REFUSED'))) { if (e.message &&
(e.message.includes('ECONNREFUSED') ||
e.message.includes('ERR_CONNECTION_REFUSED') ||
e.message.includes('Bad Gateway'))) {
log.info("No connection to sync server."); log.info("No connection to sync server.");
return { return {
@ -263,9 +267,7 @@ async function getEntityRow(entityName, entityId) {
const entity = await sql.getRow(`SELECT * FROM ${entityName} WHERE ${primaryKey} = ?`, [entityId]); const entity = await sql.getRow(`SELECT * FROM ${entityName} WHERE ${primaryKey} = ?`, [entityId]);
if (!entity) { if (!entity) {
console.log(entityName, entityId); throw new Error(`Entity ${entityName} ${entityId} not found.`);
console.log(`SELECT * FROM ${entityName} WHERE ${primaryKey} = '${entityId}'`);
} }
if (['note_contents', 'note_revisions'].includes(entityName) && entity.content !== null) { if (['note_contents', 'note_revisions'].includes(entityName) && entity.content !== null) {