Skip to content

Commit

Permalink
fix: cleanup request cache after timeout [SPA-1711] (#482)
Browse files Browse the repository at this point in the history
* fix: cleanup after timeout as well

* fix: add a warning log when REQUESTED_ENTITIES was not accepted
  • Loading branch information
Chaoste authored Dec 21, 2023
1 parent f76f19b commit 87000b4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/visual-sdk/src/store/EditorEntityStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 87000b4

Please sign in to comment.