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

In memory cache (localforage) size is ignored #4630

Closed
4 tasks
lkrzyzanek opened this issue Oct 4, 2022 · 2 comments
Closed
4 tasks

In memory cache (localforage) size is ignored #4630

lkrzyzanek opened this issue Oct 4, 2022 · 2 comments

Comments

@lkrzyzanek
Copy link

Issue workflow progress

Progress of the issue based on the Contributor Workflow

Make sure to fork this template and run yarn generate in the terminal.

Please make sure Mesh package versions under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided
  • 4. A pull request is pending review

Describe the bug

By defining the localforage cache like this, the size is ignored:

cache:
  localforage:
    name: "my-cache"
    size: 1000
    storeName: "my-cache-store"

To Reproduce
Configure localforage as described above and then check the size of the mesh cache. It's always 4980736 which is default size for localforage.

The bug is here: https://github.com/Urigo/graphql-mesh/blob/master/packages/cache/localforage/src/index.ts#L13
config.size is simply not used at all.
Then creation of InMemoryLRU https://github.com/Urigo/graphql-mesh/blob/master/packages/cache/localforage/src/InMemoryLRUDriver.ts#L15 has options.size = 4980736 and not 1000

Expected behavior

size should be 1000.

It also be very very useful if Mesh will log info about current configuration of the cache. Now there is no mention about cache at all.

Environment:

  • OS: Mac OSX
  • @graphql-mesh/cli: 0.78.28
  • NodeJS: 16
@theguild-bot theguild-bot mentioned this issue Oct 11, 2022
@ardatan
Copy link
Owner

ardatan commented Oct 18, 2022

Fixed via c751c33

@ardatan ardatan closed this as completed Oct 18, 2022
@lkrzyzanek
Copy link
Author

Thank you @ardatan !

@theguild-bot theguild-bot mentioned this issue Sep 28, 2023
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

2 participants