Merge pull request #25414 from overleaf/bg-history-only-log-content-mismatch-once-per-request

log warning for content hash mismatch only on first occurrence

GitOrigin-RevId: ff09f8c262461488bd564ea0644d414bb32ff17e
This commit is contained in:
Brian Gough
2025-05-08 15:32:36 +01:00
committed by Copybot
parent 3242376d19
commit 9cf284aefa
@@ -167,10 +167,13 @@ async function persistChanges(projectId, allChanges, limits, clientEndVersion) {
const actualHash = content != null ? getContentHash(content) : null
logger.debug({ expectedHash, actualHash }, 'validating content hash')
if (actualHash !== expectedHash) {
logger.warn(
{ projectId, path, expectedHash, actualHash },
'content hash mismatch'
)
// only log a warning on the first mismatch in each persistChanges call
if (!resyncNeeded) {
logger.warn(
{ projectId, path, expectedHash, actualHash },
'content hash mismatch'
)
}
resyncNeeded = true
}