hi Jubo,

Thanks for your contribution. I  already reviewed it.

Your ideas and improvements are very good for me, but there are 2
small problems as follows

1.  This pr Must ensure CI can pass. you can see this error [1].
2.  Can the following 1 hour be configured?

> Set the status for the upstream service, when the service is registered, set 
> the status of the service list in the DB according to the service list in the 
> event message, and record the service status change time. Set status false 
> when the service deregistration. When the service changes or the admin 
> starts, the service that is unavailable for more than 1 hour is removed to 
> avoid the zombie service from existing in the DB all the time.



[1] : 
https://github.com/apache/incubator-shenyu/runs/5655637482?check_suite_focus=true

Shi Jubo <jer...@hotmail.com> 于2022年3月23日周三 15:00写道:
>
> Hello!
>
>
> For PR#3100 (Fixes 
> #3017<https://github.com/apache/incubator-shenyu/issues/3017> ) is described 
> below, please review the code. thank!
>
> Existing service registration and deregistration processing and problems:
> 1. For the use of the registry, when there is a service started and shutdown, 
> all available services will be queried from the registry during registration 
> processing, and event messages will be published for service registration.
> 2. For http registration, when a service is started and shutdown, the service 
> can only be registered.
> 3. The event subscriber is not sure what the service register type. When a 
> service is registered, the list of services in the event message is 
> processed, the list of services in the DB is queried, the list of services in 
> the event message is compared with the list of services in the DB, and the 
> services that do not exist in the former are added to the latter to achieve 
> the purpose of service registration. However, the stopped service is not 
> removed from the DB list, and if there is a service offline, the gateway will 
> still send the request to the node.
> 4. Http registration, after the service shutdown, the dependent heartbeat 
> check finds that the service is unavailable, and then removes it from the 
> upstream service list. There is a timely removal that causes the gateway to 
> send requests to the downed node.
>
> Modification Notes:
> 1. Active deregistration when the http service is stopped, EventType=DELETED. 
> Http registration and use registry registration to differentiate processing.
> 2. Set the status for the upstream service, when the service is registered, 
> set the status of the service list in the DB according to the service list in 
> the event message, and record the service status change time. Set status 
> false when the service deregistration. When the service changes or the admin 
> starts, the service that is unavailable for more than 1 hour is removed to 
> avoid the zombie service from existing in the DB all the time.
> 3. The new services and services with changed status are handed over to the 
> http registrar for processing.
> 4. If it is http registration, the http registrar adds the service to the 
> service list according to the service status, or removes it from the service 
> list, and then updates the DB and sync to the service list cache. Service 
> registration processing ended.
> 5. Non-http registration continues to be processed. If the service is logged 
> off, remove the service from the DB service list as the list of available 
> services (the current non-http registration does not exist, the logic is 
> retained, and can be removed), otherwise the service in the event message is 
> used as the list of available services. Based on the list of available 
> services and db services, generate the final service list, update the DB and 
> sync to the service list cache.
> _______________________________________
> Jerbo99

Reply via email to