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

Remove syncTasks from localStorage to not exceed the quota #2729

Closed
nikhilbansal opened this issue Apr 14, 2019 · 3 comments
Closed

Remove syncTasks from localStorage to not exceed the quota #2729

nikhilbansal opened this issue Apr 14, 2019 · 3 comments
Labels
1: Easy bug Bug reports feature request Requests for new features. Please be as specific as possible and provide proposal API if it you can P2: Important Priority mark - still high ;)
Milestone

Comments

@nikhilbansal
Copy link

Current behavior

Adding product to cart fails with the following error.

DOMException: Failed to execute 'setItem' on 'Storage': Setting the value of 'shop/syncTasks/1555264201406-98d5f556-671b-d61e-16c2-74f025933ffb' exceeded the quota.

The chrome storage shows 15.8MB used out of 7702MB storage.

Expected behavior

Should be able to add products to cart successfully.

Steps to reproduce the issue

This happens once the same idle browser window is accessed. The add to cart works in a new incognito browser window for the same product.

Screen Shot 2019-04-14 at 11 30 18 PM

Repository

This happens while queuing tasks to local storage in core/lib/sync/index.ts -> queue function

Can you handle fixing this bug by yourself?

Yes if I get some guidance.

Environment details

  • Browser: Version 73.0.3683.103 (Official Build) (64-bit)
  • OS: Mac OS X
  • Node: v8.10.0
  • Code Version: commit id - c4d89d4
@nikhilbansal nikhilbansal added the bug Bug reports label Apr 14, 2019
@pkarw
Copy link
Collaborator

pkarw commented Apr 14, 2019

syncTasks are stored within localStorage which is cleared out (LRU) after amount of data specified in the config. Please try to lower the https://github.com/DivanteLtd/vue-storefront/blob/159357fba37e1c9eecc1c4f128120d6964a64f24/config/default.json#L17

Another option is to set the storage to INNODB driver - https://github.com/DivanteLtd/vue-storefront/blob/159357fba37e1c9eecc1c4f128120d6964a64f24/config/default.json#L306

@nikhilbansal
Copy link
Author

We never changed the default value of elasticCacheQuota and is still 4096 which means that LRU data is not getting cleared once it goes beyond the limit. Can you please point to the code which is responsible for clearing LRU data.

Don't know how to configure INNODB driver at chrome level. However when I changed the storage driver of syncTasks to INDEXED db and refreshed the same tab which was giving error, it added the product to the cart successfully! Thanks for the pointer. :)

@pkarw pkarw added the feature request Requests for new features. Please be as specific as possible and provide proposal API if it you can label Apr 16, 2019
@pkarw pkarw changed the title DOMException: Failed to execute 'setItem' on 'Storage': Remove syncTasks from localStorage to not exceed the quota Apr 16, 2019
@pkarw
Copy link
Collaborator

pkarw commented Apr 16, 2019

Acceptance criteria:

  • syncTasks are being removed from localStorage after task is successfully executed - it should be removed in here instead of updating the task

@pkarw pkarw added 1: Easy P2: Important Priority mark - still high ;) labels Apr 16, 2019
@pkarw pkarw added this to the 1.10.0-rc.1 milestone Apr 16, 2019
pkarw added a commit that referenced this issue Apr 23, 2019
@pkarw pkarw mentioned this issue Apr 23, 2019
8 tasks
@pkarw pkarw closed this as completed Apr 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1: Easy bug Bug reports feature request Requests for new features. Please be as specific as possible and provide proposal API if it you can P2: Important Priority mark - still high ;)
Projects
None yet
Development

No branches or pull requests

2 participants