Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsplash plugin unnecessary to useRotatingCache? #673

Open
nc7s opened this issue Mar 5, 2024 · 0 comments
Open

Unsplash plugin unnecessary to useRotatingCache? #673

nc7s opened this issue Mar 5, 2024 · 0 comments

Comments

@nc7s
Copy link

nc7s commented Mar 5, 2024

A recent memory report of my Firefox showed that the extension process is holding to over 200MB of images, basically all unsplash.com, each around 2MB, meaning over 100 images. The only extension that loads them is Tabliss.

This part came across when examining the source:

const item = useRotatingCache(
() => {
loader.push();
return fetchImages(data).finally(loader.pop);
},
{ cache, setCache },
data.paused ? Number.MAX_SAFE_INTEGER : data.timeout * 1000,
[data.by, data.collections, data.featured, data.search, data.topics],
);

I'm not sure why it's necessary to cache them (in memory) on top of the browser cache. Unsplash sends a Cache-Control header with max-age=31536000, or one year. Frequent enough loads (15 min in my case, 1 hour/day/week as longer options) should be enough to prevent them from being evicted, so even a "naive" request would be from local cache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant