mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
tweaks to time values
This commit is contained in:
parent
abb122e2a9
commit
a92df38479
@ -176,7 +176,7 @@ function connectWebSocket() {
|
|||||||
ws.onmessage = messageHandler;
|
ws.onmessage = messageHandler;
|
||||||
ws.onclose = function(){
|
ws.onclose = function(){
|
||||||
// Try to reconnect in 5 seconds
|
// Try to reconnect in 5 seconds
|
||||||
setTimeout(() => connectWebSocket(), 1000);
|
setTimeout(() => connectWebSocket(), 5000);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ connectWebSocket();
|
|||||||
let lastPingTs = new Date().getTime();
|
let lastPingTs = new Date().getTime();
|
||||||
let connectionBrokenNotification = null;
|
let connectionBrokenNotification = null;
|
||||||
|
|
||||||
setInterval(() => {
|
setInterval(async () => {
|
||||||
if (new Date().getTime() - lastPingTs > 5000) {
|
if (new Date().getTime() - lastPingTs > 5000) {
|
||||||
if (!connectionBrokenNotification) {
|
if (!connectionBrokenNotification) {
|
||||||
connectionBrokenNotification = $.notify({
|
connectionBrokenNotification = $.notify({
|
||||||
@ -194,12 +194,12 @@ setInterval(() => {
|
|||||||
},{
|
},{
|
||||||
// settings
|
// settings
|
||||||
type: 'danger',
|
type: 'danger',
|
||||||
delay: 100000000
|
delay: 100000000 // keep it until we explicitly close it
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (connectionBrokenNotification) {
|
else if (connectionBrokenNotification) {
|
||||||
connectionBrokenNotification.close();
|
await connectionBrokenNotification.close();
|
||||||
connectionBrokenNotification = null;
|
connectionBrokenNotification = null;
|
||||||
|
|
||||||
showMessage("Re-connected to server");
|
showMessage("Re-connected to server");
|
||||||
|
@ -9,7 +9,7 @@ function showMessage(message) {
|
|||||||
},{
|
},{
|
||||||
// settings
|
// settings
|
||||||
type: 'success',
|
type: 'success',
|
||||||
delay: 1500
|
delay: 3000
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user