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

DDEX users poller #8380

Merged
merged 6 commits into from
May 8, 2024
Merged

DDEX users poller #8380

merged 6 commits into from
May 8, 2024

Conversation

michellebrier
Copy link
Contributor

@michellebrier michellebrier commented May 7, 2024

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

Copy link

changeset-bot bot commented May 7, 2024

⚠️ No Changeset found

Latest commit: 57538c2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

updateField(id: string, field: keyof UserRow, value: string | Date) {
return db.run(sql`
update users
set ${field} = ${value}
Copy link
Contributor

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
})

Copy link
Contributor Author

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

@stereosteve stereosteve merged commit 913c80b into main May 8, 2024
8 checks passed
@stereosteve stereosteve deleted the mbrier/proto-1804/ddex-users branch May 8, 2024 15:43
audius-infra pushed a commit that referenced this pull request May 9, 2024
[a84cf8f] ddex: multi tenant (#8401) Steve Perkins
[a0e2033] Make indexer properly resort to using gateway if chain isn't caught up (#8397) Danny
[913c80b] DDEX users poller (#8380) Michelle Brier
[a144f6a] Index all memos (v1 and v2) and use cache in index_payment_router (#8400) Marcus Pasell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants