Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/snap-client/src/Client/NetworkCache/NetworkCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ export class NetworkCache {
currentSize = new Blob([JSON.stringify(this.memoryCache)], { endings: 'native' }).size / 1024;
}

// if we still can't fit the new object after purging, skip caching
if (currentSize + newObjectSize > this.config.maxSize) {
console.warn(`Unable to cache entry for key "${key}" without exceeding maxSize (${this.config.maxSize}KB), skipping cache`);
Comment thread
chrisFrazier77 marked this conversation as resolved.
return;
}
Comment thread
korgon marked this conversation as resolved.

// store cache in memory
this.memoryCache[key] = cacheObject;

Expand Down
Loading