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

Durable Objects and silmutaneous registrations #1

Open
lkj4 opened this issue Nov 6, 2021 · 1 comment
Open

Durable Objects and silmutaneous registrations #1

lkj4 opened this issue Nov 6, 2021 · 1 comment

Comments

@lkj4
Copy link

lkj4 commented Nov 6, 2021

Just found this repo, looks pretty nice feature-wise!

The auth logic is using a DurableObject for in-memory locking of usernames when registering.
Avoid simultaneous registration with the same username!

Since you check if the username is unique why is this still a problem? And btw, are you really using Durable Objects here or just KV?

@g45t345rt
Copy link
Owner

The getData function is only using KV
It's from another package called cf-kvprefix and you can create managed indexes with it.
https://github.com/g45t345rt/cf-kvprefix

As for the username check
We have to check first if the username exists inside KV and make use of a DO to lock the value while registering.
KV is not synchronous and edge caching around the world takes a little bit of time to propagate data.
Storing a value in one instance and getting the value from another instance right away can return empty data

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