From 87000b4bf29cca6829ee2f3e4b0f33811ef1fde2 Mon Sep 17 00:00:00 2001 From: Thomas Kellermeier Date: Thu, 21 Dec 2023 15:56:30 +0100 Subject: [PATCH] fix: cleanup request cache after timeout [SPA-1711] (#482) * fix: cleanup after timeout as well * fix: add a warning log when REQUESTED_ENTITIES was not accepted --- packages/visual-sdk/src/store/EditorEntityStore.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/visual-sdk/src/store/EditorEntityStore.ts b/packages/visual-sdk/src/store/EditorEntityStore.ts index 290d5d07..68d6b639 100644 --- a/packages/visual-sdk/src/store/EditorEntityStore.ts +++ b/packages/visual-sdk/src/store/EditorEntityStore.ts @@ -99,12 +99,18 @@ export class EditorEntityStore extends EntityStore { ids.forEach((id) => this.cleanupPromise(id)); unsubscribe(); + } else { + console.warn('Unexpected entities received in REQUESTED_ENTITIES. Ignoring this response.') } } ); const timeout = setTimeout(() => { - reject(new Error('Request for entities timed out')); + reject(new Error(`Request for entities timed out ${this.timeoutDuration}ms} for ${cacheId}`)); + + this.cleanupPromise(cacheId); + ids.forEach((id) => this.cleanupPromise(id)); + unsubscribe(); }, this.timeoutDuration);