-
Notifications
You must be signed in to change notification settings - Fork 471
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
Incompatibility between handle
tsdoc and implementation
#2928
Comments
If you have two services that register a handler for the same protocol, it'd be a last-update-wins situation which (for example) would make the functionality of your node dependent on the order of the services defined in the service map. One day some well-wisher decides to put them into alphabetical order and then things mysteriously start to break. Throwing an error if a handler is already registered means you have to explicitly un-register a previously registered handler first - the expectation is that an attempt to register two handlers for the same protocol is probably an error. The docs should be updated though. |
the use case in Lodestar is that we have to update the handlers across hard forks, I am not sure about the internals of Maybe a flag to by pass the error and allow override? |
unhandle+handle triggers |
A |
Adds a `force` flag to `libp2p.handle` that means the method will not throw if a handler already exists for the protocol being handled. Fixes #2928
Adds a `force` flag to `libp2p.handle` that means the method will not throw if a handler already exists for the protocol being handled. Fixes #2928
Adds a `force` flag to `libp2p.handle` that means the method will not throw if a handler already exists for the protocol being handled. Fixes #2928
Version:
all
Platform:
all
Subsystem:
registrar
Severity:
medium (due to blatantly incorrect documentation)
Description:
o The tsdoc says you can override the existing handler by calling
handle
. but turns out it is an error to override an existing handler.I don't see why replacing a handler should be an error.
The text was updated successfully, but these errors were encountered: