diff --git a/plugins/catalog-backend/src/database/DefaultProcessingDatabase.ts b/plugins/catalog-backend/src/database/DefaultProcessingDatabase.ts index 1cf2643339..c1a8ee9d33 100644 --- a/plugins/catalog-backend/src/database/DefaultProcessingDatabase.ts +++ b/plugins/catalog-backend/src/database/DefaultProcessingDatabase.ts @@ -145,20 +145,22 @@ export class DefaultProcessingDatabase implements ProcessingDatabase { BATCH_SIZE, ); - // Delete old refresh keys - await tx('refresh_keys') - .where({ entity_id: id }) - .delete(); + if (refreshKeys && refreshKeys.length > 0) { + // Delete old refresh keys + await tx('refresh_keys') + .where({ entity_id: id }) + .delete(); - // Insert the refresh keys for the processed entity - await tx.batchInsert( - 'refresh_keys', - refreshKeys.map(k => ({ - entity_id: id, - key: k.key, - })), - BATCH_SIZE, - ); + // Insert the refresh keys for the processed entity + await tx.batchInsert( + 'refresh_keys', + refreshKeys.map(k => ({ + entity_id: id, + key: k.key, + })), + BATCH_SIZE, + ); + } return { previous: { diff --git a/plugins/catalog-backend/src/modules/core/UrlReaderProcessor.ts b/plugins/catalog-backend/src/modules/core/UrlReaderProcessor.ts index 0ecd6d5a42..b1b1f64fdc 100644 --- a/plugins/catalog-backend/src/modules/core/UrlReaderProcessor.ts +++ b/plugins/catalog-backend/src/modules/core/UrlReaderProcessor.ts @@ -102,6 +102,7 @@ export class UrlReaderProcessor implements CatalogProcessor { for (const parseResult of cacheItem.value) { emit(parseResult); } + emit(processingResult.refresh(`${location.type}:${location.target}`)); } else if (error.name === 'NotFoundError') { if (!optional) { emit(processingResult.notFoundError(location, message));