Closed furanzujin closed 2 years ago
The alias regenerate is triggered by the $services.changed
internal event which is fired when the service registry is changed.
So if you have a ServiceA which is running on 3 nodes, and 1 node disconnected, the service registry is not changed, because ServiceA is still available, no need for a regeneration. So it's by design.
Your use case is not a normal production case when a service is available in different schemas with the same version number.
To cover your use case your solution could be good. But I won't add it to the moleculer-web because in a normal use case it can't cause a problem.
@icebob , Thanks for your fast answer. We will keep our solution as it has been implemented.
Hello,
We are using the
autoAliases
feature provided bymoleculer-web
. We have experienced some unexpected behavior withregenerateAllAutoAliases
.Working scenario:
Failing scenario:
The
regenerateAllAutoAliases
is based on the moleculer registry. The moleculer registry is updated once the node is disconnected but theautoAliases
are not regenerated right after that.We believe this behavior is intentional to avoid early revocation of the previous paths. Do you confirm this?
As we don't use routes versioning, we implemented a workaround. We subscribe to the
$node.disconnected
event to trigger a new execution of theregenerateAllAutoAliases
method. Do you think there are caveats with this implementation? Is there any better way to do this?