totem / discover

Service Discovery for Docker
MIT License
55 stars 11 forks source link

unregister services in any case a container isn't available any more #15

Closed starkj closed 10 years ago

starkj commented 10 years ago

It seems to me that docker emits a die-event (in addition) every time a container stops, gets killed or dies on its own. Unfortunately I haven't found any documentation on this behavior.

I think it would be better to unregister services in any case a container isn't available any more. So I suggest to check for "die" instead of "stop" here: https://github.com/totem/discover/blob/develop/lib/discover.js#L161

What do you think?

mmoulton commented 10 years ago

I have not problem switching to this behavior if I can guarantee that the 'die' event fires for 'stop' as well as other events on a container. I will walk the Docker code base to see if I can better understand when this event will fire.

If we can't guarantee this, we can look into queueing/resolving service removal events so we could request a service to be removed for both a 'stop', 'die' and any other appropriate event, but only make a DELETE call to Etcd once.

mmoulton commented 10 years ago

This has been resolved in Release 0.4.0.

I confirmed in the docker source that the docker container will emit a 'die' event every time it stops running, making that event be a better target for removing service registries.

starkj commented 10 years ago

cool, thx for investigating this