Fix/properly reset cache and queues on server url change and backup import (#725)

* Reset cache on server url change

* Reset image queue

* Completely reset apollo store
This commit is contained in:
schroda
2024-04-10 01:23:08 +02:00
committed by GitHub
parent d74bd2f80d
commit f036f01f70
3 changed files with 18 additions and 2 deletions

View File

@@ -34,6 +34,16 @@ export class Queue {
this.queue = pLimit(concurrency);
}
clear(): void {
this.pendingKeyToPromiseMap.forEach((promise) => {
promise.reject(new Error('Queue::clear: called'));
});
this.pendingKeyToPriorityMap.clear();
this.pendingKeyToFnMap.clear();
this.pendingKeyToPromiseMap.clear();
}
enqueue<T>(key: Key, fn: () => PromiseLike<T> | T, priority: QueuePriority = Priority.NORMAL): Promise<T> {
this.counter = (this.counter + 1) % Infinity;
const actualKey = `${key}_${this.counter}`;