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

Fix double prefix with TTL #107

Merged
merged 1 commit into from
May 5, 2020

Conversation

soundstep
Copy link
Contributor

@soundstep soundstep commented May 4, 2020

Entries set with a TTL are not deleted, the delete call is made with a double prefix which does not delete the entry.

Corresponding issue: #108

@coveralls
Copy link

coveralls commented May 4, 2020

Coverage Status

Coverage remained the same at 100.0% when pulling f144622 on soundstep:fix-double-prefix into 57c03a4 on lukechilds:master.

@Kikobeats
Copy link
Contributor

Hum, correct me if I'm wrong, the raw key need to be preserved in order definitely delete it at https://github.com/soundstep/keyv/blob/fix-double-prefix/src/index.js#L67, right?

BTW, @lukechilds can you take a look to this? 🙂

@soundstep
Copy link
Contributor Author

soundstep commented May 4, 2020

@Kikobeats Yeah both are needed, the param key remains to be sent to the delete member function (the line you mentioned), which also does the prefixing (that was the doubling), and the keyPrefixed variable is used to get the entry from the store (as before there: https://github.com/soundstep/keyv/blob/fix-double-prefix/src/index.js#L57).

@soundstep
Copy link
Contributor Author

As an aside, re-assigning a function param is not great, ideally a keyPrefixed should be created every time the _getKeyPrefix is called. That would make things clearer, for example in the set function.
But that's "style" so I haven't done that in the PR.

@lukechilds
Copy link
Contributor

Thank you so much for this @soundstep, great spot!

@lukechilds lukechilds closed this May 5, 2020
@lukechilds lukechilds reopened this May 5, 2020
@lukechilds
Copy link
Contributor

As an aside, re-assigning a function param is not great, ideally a keyPrefixed should be created every time the _getKeyPrefix is called. That would make things clearer, for example in the set function.
But that's "style" so I haven't done that in the PR.

Can you explain a little bit more what you mean by this?

@lukechilds lukechilds merged commit f144622 into jaredwray:master May 5, 2020
@lukechilds
Copy link
Contributor

Ahh I get it, implemented in b879028

@lukechilds
Copy link
Contributor

Published as keyv@4.0.1 🎉

@soundstep
Copy link
Contributor Author

No problem @lukechilds !

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

Successfully merging this pull request may close these issues.

None yet

4 participants