mirror of
https://github.com/zadam/trilium.git
synced 2025-02-25 15:35:43 +08:00
delay protected session expiration check after DB init, fixes #2855
This commit is contained in:
parent
c51e6107a1
commit
04379b4e1f
1 changed files with 12 additions and 9 deletions
|
@ -3,6 +3,7 @@
|
|||
const log = require('./log');
|
||||
const dataEncryptionService = require('./data_encryption');
|
||||
const options = require("./options");
|
||||
const sqlInit = require("./sql_init");
|
||||
|
||||
let dataKey = null;
|
||||
|
||||
|
@ -63,17 +64,19 @@ function touchProtectedSession() {
|
|||
}
|
||||
}
|
||||
|
||||
setInterval(() => {
|
||||
const protectedSessionTimeout = options.getOptionInt('protectedSessionTimeout');
|
||||
if (isProtectedSessionAvailable()
|
||||
&& lastProtectedSessionOperationDate
|
||||
&& Date.now() - lastProtectedSessionOperationDate > protectedSessionTimeout * 1000) {
|
||||
sqlInit.dbReady.then(() => {
|
||||
setInterval(() => {
|
||||
const protectedSessionTimeout = options.getOptionInt('protectedSessionTimeout');
|
||||
if (isProtectedSessionAvailable()
|
||||
&& lastProtectedSessionOperationDate
|
||||
&& Date.now() - lastProtectedSessionOperationDate > protectedSessionTimeout * 1000) {
|
||||
|
||||
resetDataKey();
|
||||
resetDataKey();
|
||||
|
||||
require('./ws').reloadFrontend();
|
||||
}
|
||||
}, 30000);
|
||||
require('./ws').reloadFrontend();
|
||||
}
|
||||
}, 30000);
|
||||
});
|
||||
|
||||
|
||||
module.exports = {
|
||||
|
|
Loading…
Reference in a new issue