Skip to content

Commit f745e21

Browse files
committed
use better-sqlite3
1 parent 5f2361e commit f745e21

File tree

7 files changed

+210
-55
lines changed

7 files changed

+210
-55
lines changed

electron.js

-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ app.on('window-all-closed', () => {
2424
app.on('ready', async () => {
2525
app.setAppUserModelId('com.github.zadam.trilium');
2626

27-
await sqlInit.dbConnection;
28-
2927
// if db is not initialized -> setup process
3028
// if db is initialized, then we need to wait until the migration process is finished
3129
if (await sqlInit.isDbInitialized()) {

package-lock.json

+151-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"dependencies": {
2424
"async-mutex": "0.2.2",
2525
"axios": "0.19.2",
26+
"better-sqlite3": "^7.1.0",
2627
"body-parser": "1.19.0",
2728
"cls-hooked": "4.2.2",
2829
"commonmark": "0.29.1",
@@ -54,7 +55,7 @@
5455
"jimp": "0.10.3",
5556
"mime-types": "2.1.27",
5657
"multer": "1.4.2",
57-
"node-abi": "2.16.0",
58+
"node-abi": "2.18.0",
5859
"open": "7.0.3",
5960
"portscanner": "2.2.0",
6061
"rand-token": "1.0.1",

src/routes/api/export.js

+4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ async function exportBranch(req, res) {
2323

2424
try {
2525
if (type === 'subtree' && (format === 'html' || format === 'markdown')) {
26+
const start = Date.now();
27+
2628
await zipExportService.exportToZip(taskContext, branch, format, res);
29+
30+
console.log("Export took", Date.now() - start, "ms");
2731
}
2832
else if (type === 'single') {
2933
await singleExportService.exportSingleNote(taskContext, branch, format, res);

src/routes/api/import.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ async function importToBranch(req) {
5050
if (extension === '.tar' && options.explodeArchives) {
5151
note = await tarImportService.importTar(taskContext, file.buffer, parentNote);
5252
} else if (extension === '.zip' && options.explodeArchives) {
53+
const start = Date.now();
54+
5355
note = await zipImportService.importZip(taskContext, file.buffer, parentNote);
56+
57+
console.log("Import took", Date.now() - start, "ms");
5458
} else if (extension === '.opml' && options.explodeArchives) {
5559
note = await opmlImportService.importOpml(taskContext, file.buffer, parentNote);
5660
} else if (extension === '.enex' && options.explodeArchives) {
@@ -85,4 +89,4 @@ async function importToBranch(req) {
8589

8690
module.exports = {
8791
importToBranch
88-
};
92+
};

0 commit comments

Comments
 (0)