Registry items could get duplicated #335
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A friend of mine had issue with the "How to use FoundKey" tutorial reappearing every page load, even after completing the tutorial.
They managed to resolve the issue by calling
i/registry/remove
endpoint with thetutorial
key ~10 times, untilNO_SUCH_KEY
error.Frontend fetches the registry keys from
i/registry/get-all
endpoint, which returns every key only once (keeping only the last entry!). Meanwhilei/registry/set
only updates the first entry in the database.I'm not sure how the registry keys got duplicated in the first place, though... In theory
export default define(meta, paramDef, async (ps, user) => {
has a race condition, where multiple keys could be inserted (not updated), but it shouldn't be able to be triggered that easily (to accumulate 10 duplicate keys).
I think adding a unique constraint (over user, scope, key) is a good idea to disallow the same key getting added multiple times.