WS debugging messages and small changes

This commit is contained in:
zadam 2019-10-24 23:02:29 +02:00
parent 69d739400c
commit 4570319517
8 changed files with 19 additions and 15 deletions

View file

@ -1,4 +1,4 @@
FROM node:12.12.0-alpine
FROM node:12.13.0-alpine
# Create app directory
WORKDIR /usr/src/app

View file

@ -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

View file

@ -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/

12
package-lock.json generated
View file

@ -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"

View file

@ -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",

View file

@ -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) {

View file

@ -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);

View file

@ -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();
}