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

Handle cache storage overflow #223

Closed
1 task done
Tzal3x opened this issue Sep 27, 2024 · 0 comments · Fixed by #237
Closed
1 task done

Handle cache storage overflow #223

Tzal3x opened this issue Sep 27, 2024 · 0 comments · Fixed by #237
Assignees
Labels

Comments

@Tzal3x
Copy link
Collaborator

Tzal3x commented Sep 27, 2024

Description

We should handle the case where we attempt to store new entries to the service worker's cache but it is full.

From the MDN docs:

Attempting to store more than an origin's quota using IndexedDB, Cache, or OPFS, for example, fails with a QuotaExceededError exception.
Web developers should wrap JavaScript that writes to browser storage within try...catch blocks. Freeing up space by deleting data before storing new data is also recommended.

Therefore, we should add a try/except block on "save to cache" attempts, looking out for a QuotaExceededError and either:

  • Replace the oldest entry of the cache with the new one
  • Replace the less frequently used entry of the cache
  • or something else?

Component

portal

Code of Conduct

  • I agree to follow this project's Code of Conduct.
@Tzal3x Tzal3x added enhancement New feature or request service-worker cache labels Sep 27, 2024
@Tzal3x Tzal3x mentioned this issue Oct 4, 2024
9 tasks
@Tzal3x Tzal3x assigned Tzal3x and unassigned giac-mysten Oct 4, 2024
@Tzal3x Tzal3x linked a pull request Oct 8, 2024 that will close this issue
@Tzal3x Tzal3x closed this as completed Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants