mirror of
https://github.com/zadam/trilium.git
synced 2025-10-30 18:05:55 +01:00
separate DB connection for each transaction (just for the record, will be reverted probably)
This commit is contained in:
@@ -2,32 +2,32 @@ const sql = require('./sql');
|
||||
const source_id = require('./source_id');
|
||||
const utils = require('./utils');
|
||||
|
||||
async function addNoteSync(noteId, sourceId) {
|
||||
await addEntitySync("notes", noteId, sourceId)
|
||||
async function addNoteSync(db, noteId, sourceId) {
|
||||
await addEntitySync(db, "notes", noteId, sourceId)
|
||||
}
|
||||
|
||||
async function addNoteTreeSync(noteTreeId, sourceId) {
|
||||
await addEntitySync("notes_tree", noteTreeId, sourceId)
|
||||
async function addNoteTreeSync(db, noteTreeId, sourceId) {
|
||||
await addEntitySync(db, "notes_tree", noteTreeId, sourceId)
|
||||
}
|
||||
|
||||
async function addNoteReorderingSync(parentNoteTreeId, sourceId) {
|
||||
await addEntitySync("notes_reordering", parentNoteTreeId, sourceId)
|
||||
async function addNoteReorderingSync(db, parentNoteTreeId, sourceId) {
|
||||
await addEntitySync(db, "notes_reordering", parentNoteTreeId, sourceId)
|
||||
}
|
||||
|
||||
async function addNoteHistorySync(noteHistoryId, sourceId) {
|
||||
await addEntitySync("notes_history", noteHistoryId, sourceId);
|
||||
async function addNoteHistorySync(db, noteHistoryId, sourceId) {
|
||||
await addEntitySync(db, "notes_history", noteHistoryId, sourceId);
|
||||
}
|
||||
|
||||
async function addOptionsSync(optName, sourceId) {
|
||||
await addEntitySync("options", optName, sourceId);
|
||||
async function addOptionsSync(db, optName, sourceId) {
|
||||
await addEntitySync(db, "options", optName, sourceId);
|
||||
}
|
||||
|
||||
async function addRecentNoteSync(notePath, sourceId) {
|
||||
await addEntitySync("recent_notes", notePath, sourceId);
|
||||
async function addRecentNoteSync(db, notePath, sourceId) {
|
||||
await addEntitySync(db, "recent_notes", notePath, sourceId);
|
||||
}
|
||||
|
||||
async function addEntitySync(entityName, entityId, sourceId) {
|
||||
await sql.replace("sync", {
|
||||
async function addEntitySync(db, entityName, entityId, sourceId) {
|
||||
await sql.replace(db, "sync", {
|
||||
entity_name: entityName,
|
||||
entity_id: entityId,
|
||||
sync_date: utils.nowTimestamp(),
|
||||
|
||||
Reference in New Issue
Block a user