Skip to content

Commit e1bece6

Browse files
committed
fix accounting issue
1 parent dfb1b33 commit e1bece6

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

apps/sim/lib/knowledge/connectors/sync-engine.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,10 +689,19 @@ export async function executeSync(
689689
contentHash: fullDoc.contentHash ?? op.extDoc.contentHash,
690690
metadata: { ...op.extDoc.metadata, ...fullDoc.metadata },
691691
})
692+
} else if (op.type === 'update') {
693+
// Already-indexed file is kept as last-known-good (not downgraded), so it
694+
// counts as unchanged rather than slipping past every result counter.
695+
result.docsUnchanged++
692696
}
693697
return null
694698
}
695-
if (!fullDoc?.content.trim()) return null
699+
if (!fullDoc?.content.trim()) {
700+
// An empty re-fetch leaves an already-indexed update as last-known-good; count
701+
// it as unchanged so the totals still reconcile with documents seen.
702+
if (op.type === 'update') result.docsUnchanged++
703+
return null
704+
}
696705
const hydratedHash = fullDoc.contentHash ?? op.extDoc.contentHash
697706
if (
698707
op.type === 'update' &&

0 commit comments

Comments
 (0)