Merge pull request #17627 from backstage/freben/less-cache-updating

Ensure that entity cache state is only written to the database when actually changed
This commit is contained in:
Ben Lambert
2023-05-03 15:30:26 +02:00
committed by GitHub
2 changed files with 9 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': patch
---
Ensure that entity cache state is only written to the database when actually changed
@@ -150,7 +150,10 @@ export class DefaultCatalogProcessingEngine implements CatalogProcessingEngine {
track.markProcessorsCompleted(result);
if (result.ok) {
if (stableStringify(state) !== stableStringify(result.state)) {
const { ttl: _, ...stateWithoutTtl } = state ?? {};
if (
stableStringify(stateWithoutTtl) !== stableStringify(result.state)
) {
await this.processingDatabase.transaction(async tx => {
await this.processingDatabase.updateEntityCache(tx, {
id,