-
Notifications
You must be signed in to change notification settings - Fork 6
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
add warning to multiple sdk instances with the same parameters #566
base: master
Are you sure you want to change the base?
add warning to multiple sdk instances with the same parameters #566
Conversation
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.
If I understand correctly, this provides two "entry points" to the Actyx client. If that is the case, I feel that the behavior should be better documented for the user.
type Signature = AppManifest['signature'] | ||
type ActyxHost = ActyxOpts['actyxHost'] | ||
type ActyxPort = ActyxOpts['actyxPort'] | ||
type Param = [AppId, Version, Signature, ActyxHost, ActyxPort] |
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 dislike the Param
name, Params
/Parameters
makes much more sense given it's a list.
I'd also add a brief docstring
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.
these types aren’t visible to anyone, so a docstring won’t be displayed anywhere — did you mean a comment?
No. This is purely an internal logging mechanism opaque to the user |
const oldDispose = actyx.dispose | ||
actyx.dispose = () => { | ||
const result = oldDispose() | ||
actyxInstanceRegister.subOne(manifest, opts) |
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.
Does oldDispose()
invoke some user callbacks? If so, such callback could try to create a new SDK instance, which in that case would log the “multiple connections” error. If correctness permits it, I’d do the subOne
before the oldDispose
.
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.
It only calls MultiplexedWebsocket.dispose
under the hood.
There should be no difference between both orders since this is a sync function.
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.
My worry was that there might be an event emitted to user code from that sync function — and if we add such a thing in the future then this problem may well surface.
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.
Ah, that's a valid concern
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.
fixed fc39630
type Signature = AppManifest['signature'] | ||
type ActyxHost = ActyxOpts['actyxHost'] | ||
type ActyxPort = ActyxOpts['actyxPort'] | ||
type Param = [AppId, Version, Signature, ActyxHost, ActyxPort] |
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.
these types aren’t visible to anyone, so a docstring won’t be displayed anywhere — did you mean a comment?
Co-authored-by: Roland Kuhn <[email protected]>
No description provided.