-
-
Notifications
You must be signed in to change notification settings - Fork 42
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 bug in POST endpoint where it would timeout #19
Conversation
Hey, thanks! But |
Except in the scenario where no TODOs or users exist, then it gets stuck in an infinite loop and hits the cloudflare worker timeout scenario. When no TODOs exist, the DB.read looks to return Line 36 in 21a6af9
This screenshot shows the user This screenshot shows the timeout error that happens when a POST request is made to add a todo to |
Ah shoot, sorry – you're right. |
examples/workers/kv-todos/model.ts
Outdated
/** | ||
* Checks if a specifc `Todo` record already exists | ||
*/ | ||
export async function exists(username: string, uid: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this new utility. It's redundant as find()
serves the same purpose. This PR should only have a fix to DB.read
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've rebased all changes now into aca4266
(#19), it looks like typescript compiler is compiling into syntax which node12 does not support -- https://github.com/lukeed/worktop/runs/2209343024
Ah, sorry. This is |
- verified, only updates "kv" output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the noise, thought I could get away with doing this via web editor only... nope 😅
Thanks!
Hurrah! I'm glad I reported this as I thought it was a bug in the example but it was really a little bug in worktop itself. Thank you for figuring that out and helping me with the pull-request |
Yeah :) All apps had Thanks again, will go out in next release |
The
toSearch
function was never returningfalse
because thefind
function returnsnull
if it can not find a Todo record.Adding a new function called
exists
which will always return a boolean.true
if the record exists andfalse
if it does not.