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

Optimize initialize user code path for known new users #2181

Open
texuf opened this issue Jan 28, 2025 · 0 comments
Open

Optimize initialize user code path for known new users #2181

texuf opened this issue Jan 28, 2025 · 0 comments
Assignees
Labels
area/sdk workitem Workitem that requires implementation

Comments

@texuf
Copy link
Contributor

texuf commented Jan 28, 2025

Description

The initialize user code path in typescript first calls getStream to see if a stream exists, then calls create stream. It does so because it

  • handles partially created users (if the user lost connectivity half way through)
  • handles any upgrades to the protocol (if we add a new user stream in the future)

However calling getStream on a stream that does not exist is an expensive operation (around 2 seconds)

We would like to do this instead: When we know we are dealing with a new user, always call create stream first. In the case where the stream already exists, catch that error and call get stream instead. This will require some exploration to make sure that the error returned in the partially created user case is properly handled.

@texuf texuf added area/sdk workitem Workitem that requires implementation labels Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/sdk workitem Workitem that requires implementation
Projects
Status: No status
Development

No branches or pull requests

2 participants