[bug] Delete redis proxy key on cleanDocumentOnExit when all editors quit; For bug 77217

This commit is contained in:
Sergey Konovalov
2025-10-26 02:26:08 +03:00
parent 0a0d3339b1
commit 5af7e20090
3 changed files with 14 additions and 0 deletions

View File

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

View File

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

View File

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