load user pins in the database worker

This commit is contained in:
ansuz
2020-03-25 11:39:14 -04:00
parent 50e8893b24
commit 4ba36a9173
4 changed files with 58 additions and 28 deletions

View File

@@ -625,6 +625,8 @@ const handleGetHistoryRange = function (Env, Server, seq, userId, parsed) {
Env.Log.error("HK_GET_OLDER_HISTORY", err);
}
if (!Array.isArray(messages)) { messages = []; }
var toSend = [];
if (typeof (desiredMessages) === "number") {
toSend = messages.slice(-desiredMessages);
@@ -886,6 +888,15 @@ HK.initializeIndexWorkers = function (Env, config, _cb) {
});
};
Env.getPinState = function (safeKey, cb) {
Env.pinStore.getWeakLock(safeKey, function (next) {
sendCommand({
key: safeKey,
command: 'GET_PIN_STATE',
}, Util.both(next, cb));
});
};
//console.log("index workers ready");
cb(void 0);
});