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

#8 added addDataSources convenience method #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

arawinters
Copy link
Contributor

Pull request questions

Which issue does this address

resolves #8

Why was change needed

Calling SzGrpcConfig.addDataSource multiple times asyncronously results in Connection Dropped error. I had a hunch that it had something to do with the nature of non-threaded async requests over the grpc client. (I was right)

Normally you would use a Generator Function along with await and async but google has made this all but impossible by requiring using the CommonJS or Closure module style instead of the newer defacto standard ESM. Until google updates their protoc compiler plugins to use ESM our hands are kind of tied on this.

Creating promises one after the previous is at best tedious and at worst mind-boggling depending on how familiar a developer is with node/js. I decided to write a helper function with internal subs(basically a class masquerading as a function) that handles the wackyness of doing sequential promises. This is preferable over asking the user to work around the limitations of node/promises in a snippet/example.

What does change improve

Ability to call SzConfig.addDataSources(configHandle, ['DS1','DS2','DS3']) in one line instead of 50 lines of example code.

@arawinters arawinters requested review from docktermj, barrycaceres and a team February 14, 2025 00:50
@arawinters arawinters self-assigned this Feb 14, 2025
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

Successfully merging this pull request may close these issues.

SzGrpcConfig.addDataSource disconnects on adding multiple datasources
2 participants