Merge pull request #26862 from backstage/freben/cache-etag

make sure that etags don't expire spuriously
This commit is contained in:
Fredrik Adelöw
2024-09-26 16:10:36 +02:00
committed by GitHub
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));