Skip to content

Build your personal knowledge base with Trilium Notes

WS debugging messages and small changes

zadam4570319517c7
diff --git a/Dockerfile b/Dockerfile
index 3d0540d8e6..820b4ba3d8 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM node:12.12.0-alpine
+FROM node:12.13.0-alpine
# Create app directory
WORKDIR /usr/src/app
diff --git a/bin/build-server.sh b/bin/build-server.sh
index d180f05285..8c4403a212 100755
--- a/bin/build-server.sh
+++ b/bin/build-server.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
PKG_DIR=dist/trilium-linux-x64-server
-NODE_VERSION=12.12.0
+NODE_VERSION=12.13.0
if [ "$1" != "DONTCOPY" ]
then
diff --git a/bin/build-win-x64.sh b/bin/build-win-x64.sh
index 048400eaee..c328d1731e 100755
--- a/bin/build-win-x64.sh
+++ b/bin/build-win-x64.sh
@@ -15,6 +15,7 @@ rm -r $SRC_DIR/node_modules/pngquant-bin/vendor/*
rm -r $SRC_DIR/node_modules/giflossy/vendor/*
rm -r $SRC_DIR/node_modules/@felixrieseberg/spellchecker/build/Release/*
rm -r $SRC_DIR/node_modules/keyboard-layout/build/Release/*
+rm -r $SRC_DIR/node_modules/cld/build/Release/*
cp -r bin/deps/win-x64/sqlite/* $SRC_DIR/node_modules/sqlite3/lib/binding/
cp bin/deps/win-x64/image/cjpeg.exe $SRC_DIR/node_modules/mozjpeg/vendor/
diff --git a/package-lock.json b/package-lock.json
index 489302d1d2..5f8e01e7af 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2978,9 +2978,9 @@
},
"dependencies": {
"@types/node": {
- "version": "10.14.21",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.21.tgz",
- "integrity": "sha512-nuFlRdBiqbF+PJIEVxm2jLFcQWN7q7iWEJGsBV4n7v1dbI9qXB8im2pMMKMCUZe092sQb5SQft2DHfuQGK5hqQ==",
+ "version": "10.17.0",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.0.tgz",
+ "integrity": "sha512-wuJwN2KV4tIRz1bu9vq5kSPasJ8IsEjZaP1ZR7KlmdUZvGF/rXy8DmXOVwUD0kAtvtJ7aqMKPqUXC0NUTDbrDg==",
"dev": true
}
}
@@ -6175,9 +6175,9 @@
}
},
"https-proxy-agent": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-3.0.0.tgz",
- "integrity": "sha512-y4jAxNEihqvBI5F3SaO2rtsjIOnnNA8sEbuiP+UhJZJHeM2NRm6c09ax2tgqme+SgUUvjao2fJXF4h3D6Cb2HQ==",
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-3.0.1.tgz",
+ "integrity": "sha512-+ML2Rbh6DAuee7d07tYGEKOEi2voWPUGan+ExdPbPW6Z3svq+JCqr0v8WmKPOkz1vOVykPCBSuobe7G8GJUtVg==",
"requires": {
"agent-base": "^4.3.0",
"debug": "^3.1.0"
diff --git a/package.json b/package.json
index a1cff6f628..05b0fd41cf 100644
--- a/package.json
+++ b/package.json
@@ -43,7 +43,7 @@
"html": "1.0.0",
"html2plaintext": "2.1.2",
"http-proxy-agent": "2.1.0",
- "https-proxy-agent": "3.0.0",
+ "https-proxy-agent": "3.0.1",
"image-type": "4.1.0",
"imagemin": "7.0.0",
"imagemin-giflossy": "5.1.10",
diff --git a/src/public/javascripts/services/server.js b/src/public/javascripts/services/server.js
index 6cfcc9a6c9..c229c1feba 100644
--- a/src/public/javascripts/services/server.js
+++ b/src/public/javascripts/services/server.js
@@ -72,7 +72,8 @@ async function ajax(url, method, data) {
const options = {
url: baseApiUrl + url,
type: method,
- headers: getHeaders()
+ headers: getHeaders(),
+ timeout: 60000
};
if (data) {
diff --git a/src/public/javascripts/services/tree_cache.js b/src/public/javascripts/services/tree_cache.js
index 73a7de6f0d..ba2e02a09f 100644
--- a/src/public/javascripts/services/tree_cache.js
+++ b/src/public/javascripts/services/tree_cache.js
@@ -97,8 +97,6 @@ class TreeCache {
const missingNoteIds = noteIds.filter(noteId => this.notes[noteId] === undefined);
if (missingNoteIds.length > 0) {
- console.trace("Refreshing", missingNoteIds);
-
const resp = await server.post('tree/load', { noteIds: missingNoteIds });
this.addResp(resp.notes, resp.branches, resp.relations);
diff --git a/src/public/javascripts/services/ws.js b/src/public/javascripts/services/ws.js
index ef36b6dc9c..df3c546794 100644
--- a/src/public/javascripts/services/ws.js
+++ b/src/public/javascripts/services/ws.js
@@ -89,7 +89,8 @@ function waitForSyncId(desiredSyncId) {
return new Promise((res, rej) => {
syncIdReachedListeners.push({
desiredSyncId,
- resolvePromise: res
+ resolvePromise: res,
+ start: Date.now()
})
});
}
@@ -116,6 +117,9 @@ async function consumeSyncData() {
syncIdReachedListeners = syncIdReachedListeners
.filter(l => l.desiredSyncId > lastSyncId);
+
+ syncIdReachedListeners.filter(l => Date.now() > l.start - 60000)
+ .forEach(l => console.log(`Waiting for syncId ${l.desiredSyncId} for ${Date.now() - l.start}`));
}
function connectWebSocket() {
@@ -138,7 +142,7 @@ setTimeout(() => {
setInterval(async () => {
if (Date.now() - lastPingTs > 30000) {
- console.log("Lost connection to server");
+ console.log(utils.now(), "Lost connection to server");
}
if (ws.readyState === ws.OPEN) {
@@ -148,7 +152,7 @@ setTimeout(() => {
}));
}
else if (ws.readyState === ws.CLOSED || ws.readyState === ws.CLOSING) {
- console.log("WS closed or closing, trying to reconnect");
+ console.log(utils.now(), "WS closed or closing, trying to reconnect");
ws = connectWebSocket();
}