make sure that etags don't expire spuriously

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2024-09-26 15:35:44 +02:00
parent 86a6694a9c
commit 8206f49ab1
3 changed files with 7 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': patch
---
Fix a bug where etags were expiring too soon in the URL reader
@@ -149,7 +149,7 @@ describe('UrlReaderProcessor', () => {
expect(mockCache.get).toHaveBeenCalledWith('v1');
expect(mockCache.get).toHaveBeenCalledTimes(1);
expect(mockCache.set).toHaveBeenCalledTimes(0);
expect(mockCache.set).toHaveBeenCalledTimes(1);
});
it('should fail load from url with error', async () => {
@@ -111,6 +111,7 @@ export class UrlReaderProcessor implements CatalogProcessor {
emit(parseResult);
}
emit(processingResult.refresh(`${location.type}:${location.target}`));
await cache.set(CACHE_KEY, cacheItem);
} else if (error.name === 'NotFoundError') {
if (!optional) {
emit(processingResult.notFoundError(location, message));