mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-02-10 18:05:07 +08:00
[bug] Delete redis proxy key on cleanDocumentOnExit when all editors quit; For bug 77217
This commit is contained in:
@ -165,6 +165,10 @@ const defaultHttpPort = 80,
|
||||
//todo remove editorDataStorage constructor usage after 8.1
|
||||
const editorData = editorDataStorage.EditorData ? new editorDataStorage.EditorData() : new editorDataStorage();
|
||||
const editorStat = editorStatStorage.EditorStat ? new editorStatStorage.EditorStat() : new editorDataStorage();
|
||||
let editorStatProxy = null;
|
||||
if (process.env.REDIS_SERVER_DB_KEYS_NUM) {
|
||||
editorStatProxy = new editorStatStorage.EditorStat(process.env.REDIS_SERVER_DB_KEYS_NUM);
|
||||
}
|
||||
const clientStatsD = statsDClient.getClient();
|
||||
let connections = []; // Active connections
|
||||
const lockDocumentsTimerId = {}; //to drop connection that can't unlockDocument
|
||||
@ -1530,6 +1534,9 @@ function* cleanDocumentOnExit(ctx, docId, deleteChanges, opt_userIndex) {
|
||||
|
||||
//clean redis (redisKeyPresenceSet and redisKeyPresenceHash removed with last element)
|
||||
yield editorData.cleanDocumentOnExit(ctx, docId);
|
||||
if (editorStatProxy?.deleteKey) {
|
||||
yield editorStatProxy.deleteKey(docId);
|
||||
}
|
||||
//remove changes
|
||||
if (deleteChanges) {
|
||||
yield taskResult.restoreInitialPassword(ctx, docId);
|
||||
@ -1748,6 +1755,7 @@ async function isSchemaCompatible([tableName, tableSchema]) {
|
||||
exports.c_oAscServerStatus = c_oAscServerStatus;
|
||||
exports.editorData = editorData;
|
||||
exports.editorStat = editorStat;
|
||||
exports.editorStatProxy = editorStatProxy;
|
||||
exports.sendData = sendData;
|
||||
exports.modifyConnectionForPassword = modifyConnectionForPassword;
|
||||
exports.parseUrl = parseUrl;
|
||||
|
||||
@ -1300,6 +1300,9 @@ const commandSfcCallback = co.wrap(function* (ctx, cmd, isSfcm, isEncrypted) {
|
||||
//todo simultaneous opening
|
||||
//clean redis (redisKeyPresenceSet and redisKeyPresenceHash removed with last element)
|
||||
yield docsCoServer.editorData.cleanDocumentOnExit(ctx, docId);
|
||||
if (docsCoServer?.editorStatProxy?.deleteKey) {
|
||||
yield docsCoServer.editorStatProxy.deleteKey(docId);
|
||||
}
|
||||
//to unlock wopi file
|
||||
yield docsCoServer.unlockWopiDoc(ctx, docId, callbackUserIndex);
|
||||
//cleanupRes can be false in case of simultaneous opening. it is OK
|
||||
|
||||
@ -503,6 +503,9 @@ EditorStat.prototype.lockNotification = async function (ctx, notificationType, t
|
||||
//true NaN !== NaN
|
||||
return this._checkAndLock(ctx, notificationType, notificationType, NaN, ttl);
|
||||
};
|
||||
EditorStat.prototype.deleteKey = async function (_key) {
|
||||
//no need
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
EditorData,
|
||||
|
||||
Reference in New Issue
Block a user