From 735a5c577d9acd9f5e1a0fa8907023b7c4c11bbc Mon Sep 17 00:00:00 2001 From: Sergey Konovalov Date: Tue, 2 Sep 2025 14:36:24 +0300 Subject: [PATCH] [bug] Skip failed checkFileExpire and continue with other files --- DocService/sources/gc.js | 41 ++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/DocService/sources/gc.js b/DocService/sources/gc.js index 7f098c1c..6c1638fc 100644 --- a/DocService/sources/gc.js +++ b/DocService/sources/gc.js @@ -87,25 +87,30 @@ const checkFileExpire = function (expireSeconds) { const shardKey = sqlBase.DocumentAdditional.prototype.getShardKey(expired[i].additional); const wopiSrc = sqlBase.DocumentAdditional.prototype.getWopiSrc(expired[i].additional); - if (currentTenant !== tenant) { - ctx.init(tenant, docId, ctx.userId, shardKey, wopiSrc); - yield ctx.initTenantCache(); - currentTenant = tenant; - } else { - ctx.setDocId(docId); - ctx.setShardKey(shardKey); - ctx.setWopiSrc(wopiSrc); - } - - //todo tenant - //check that no one is in the document - const editorsCount = yield docsCoServer.getEditorsCountPromise(ctx, docId); - if (0 === editorsCount) { - if (yield canvasService.cleanupCache(ctx, docId)) { - currentRemovedCount++; + try { + if (currentTenant !== tenant) { + ctx.init(tenant, docId, ctx.userId, shardKey, wopiSrc); + yield ctx.initTenantCache(); + currentTenant = tenant; + } else { + ctx.setDocId(docId); + ctx.setShardKey(shardKey); + ctx.setWopiSrc(wopiSrc); } - } else { - ctx.logger.debug('checkFileExpire expire but presence: editorsCount = %d', editorsCount); + + //todo tenant + //check that no one is in the document + const editorsCount = yield docsCoServer.getEditorsCountPromise(ctx, docId); + if (0 === editorsCount) { + if (yield canvasService.cleanupCache(ctx, docId)) { + currentRemovedCount++; + } + } else { + ctx.logger.debug('checkFileExpire expire but presence: editorsCount = %d', editorsCount); + } + } catch (error) { + ctx.logger.error('checkFileExpire file error: %s', error.stack); + // Continue processing other files } } removedCount += currentRemovedCount;