Open jkyberneees opened 7 years ago
@jkyberneees on startup, your hapi-service-test should have sent a message to hydra-router with its updated routes.
Hi @cjus, it does it. However the issue appears when multiple services have registered the same route. IMO the router should decide for the service that match the route but also is online.
@jkyberneees I looked into this. I don't see a way to address it. I think it's up to the service builder to ensure that routes are not reused by other services. Meaning two different services should not both register v1/{serviceName}/endpoint
. I also think that service registries have to expire at some point. Perhaps a router that ends up with a 503 might flush the service registry or perhaps a Lua script in Redis.
Hi @cjus, I can suggest you to check for service presence before accept the route match. You can see an example here: https://github.com/jkyberneees/hydra-plugin-http/blob/master/libs/proxy.js#L35 I agree on the flush of the routes if 503 is detected, that would keep the router more performant and consistent.
Regards.
Hello This discussion is old, but I have the same issue with hydra-router.
I used the different command for clean and refresh: hydra-cli refresh hydra-cli refresh node list
but hydra-cli routes show me the old dead services and then hydra-router cannot work correctly.
Is it something I am missing for cleaning/refresh ?
@arn-the-long-beard which version of hydra-cli are you using? How comfortable are you with Redis? Is this happening locally or on a production server?
Hello @cjus :)
I am using hydra-cli@1.5.5
For now this is happening locally. I am a very newbie to Hydra and Redis also. I am building micro services for a distributed system for the startup I am working.
Same problem here. I'm using hydra-cli@1.6.0
hydra-cli refresh
and hydra-cli refresh node list
keeps old routes, is not cleaning properly
The router seems to be accepting the first URL match without guarantee that such service have a running node instance. In my case I just started a hapi-service-test service and the response from the router is this:
Meaning that the hydra-router is considering old routes from the express-service-test service that I have ran in the past.
Regards, Rolando