keijack / python-eureka-client

A eureka client written in python. Support registering your python component to Eureka Server, as well as calling remote services by pulling the the Eureka registry.
MIT License
183 stars 43 forks source link

Auto Deregistration #64

Closed arunsehgals closed 2 years ago

arunsehgals commented 2 years ago

Hey keijack, is there any way to get service deregister immediately if container got killed.? example - within 2sec if we want to deregister services from eureka server after container got killed.

keijack commented 2 years ago

No, according to the implementation of eureka which base on heartbeat checking, you cannot get the Node status at once. The best way you can do is to do HA strategy (like what we have done in this library) at your client.

arunsehgals commented 2 years ago

We have python service running in container and its registering with Eureka successfully. But when the container terminates eureka is taking time to deregister container we are using ECS. Also Please suggest to reduce deregister parameter if any so that we can override the default value. What is the default time to deregister.

keijack commented 2 years ago

At this library, @atexit.register decorator is used to do the de-registration.

if you want to de-register from eureka server manually, you can call eureka_client.stop() explicitly.

arunsehgals commented 2 years ago

Solved this using python signal handlers. Thanks :-)