-
Notifications
You must be signed in to change notification settings - Fork 106
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
DDEX users poller #8380
DDEX users poller #8380
Conversation
|
packages/ddex/processor/src/db.ts
Outdated
updateField(id: string, field: keyof UserRow, value: string | Date) { | ||
return db.run(sql` | ||
update users | ||
set ${field} = ${value} |
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.
the ${field}
interpolation here will be converted by the sql
tagged template to a bind using ?
...
Instead I'd remove this and at the call site use upsert
(which will only touch the handle
field and leave other data intact):
userRepo.upsert({
id: user.id,
handle: resp.handle
})
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.
added here. also meant to update the name, not the handle, which is immutable. fixed in that commit
Description
Poll sdk every 5 mins to keep user names in the DDEX db from becoming stale. Thoughts on this frequency?
Note: this doesn't update the JWT user's name in the cookie, which I figured is not worth updating. Unless you think otherwise @stereosteve. /whoami will potentially show a stale name until they logout and login again.
Note 2: this will also console log an error if the sdk can't find a user id in discovery, which will create some noise when using fake user data for local testing.
How Has This Been Tested?
Ran server locally, ensured server polls, changed my user's name, ensured ddex persisted new name