{"action":"created","issue":{"url":"https://api.github.com/repos/rickfast/consul-client/issues/342","repository_url":"https://api.github.com/repos/rickfast/consul-client","labels_url":"https://api.github.com/repos/rickfast/consul-client/issues/342/labels{/name}","comments_url":"https://api.github.com/repos/rickfast/consul-client/issues/342/comments","events_url":"https://api.github.com/repos/rickfast/consul-client/issues/342/events","html_url":"https://github.com/rickfast/consul-client/issues/342","id":342162962,"node_id":"MDU6SXNzdWUzNDIxNjI5NjI=","number":342,"title":"ServiceHealthCache listener not triggered when service's health check turns passing","user":{"login":"dennanisny","id":5271223,"node_id":"MDQ6VXNlcjUyNzEyMjM=","avatar_url":"https://avatars1.githubusercontent.com/u/5271223?v=4","gravatar_id":"","url":"https://api.github.com/users/dennanisny","html_url":"https://github.com/dennanisny","followers_url":"https://api.github.com/users/dennanisny/followers","following_url":"https://api.github.com/users/dennanisny/following{/other_user}","gists_url":"https://api.github.com/users/dennanisny/gists{/gist_id}","starred_url":"https://api.github.com/users/dennanisny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dennanisny/subscriptions","organizations_url":"https://api.github.com/users/dennanisny/orgs","repos_url":"https://api.github.com/users/dennanisny/repos","events_url":"https://api.github.com/users/dennanisny/events{/privacy}","received_events_url":"https://api.github.com/users/dennanisny/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-07-18T03:26:04Z","updated_at":"2018-07-18T08:29:30Z","closed_at":null,"author_association":"NONE","body":"I have a service that takes about 2 minutes to start up, and the TCP health check (viewed from Consul Web UI) remains critical during the start-up period and turns green when the start-up completes.\r\nMy use case is that I need to perform some task both when the service's health check turns critical and passing.\r\nMy services are running as Docker containers and they are added/removed from Consul automatically by the Registrator.\r\nWhen I start the service, the ServiceHealthCache's listener is triggered immediately after Registrator adds the service to the Consul, while the service's TCP check is still critical from Consul Web UI. However when the TCP check turns to passing, the listener is _not_ triggered.\r\n\r\nBelow is my relevant code snippet. Appreciate if anyone could help to clarify this.\r\n```\r\nServiceHealthCache serviceHealthCache = ServiceHealthCache.newCache(\r\n                        healthClient,\r\n                        SERVICE_NAME,\r\n                        true,\r\n                        5,\r\n                        ImmutableQueryOptions.builder().addTag(\"test\").build());\r\nserviceHealthCache.addListener(newValues -> doSomething());\r\nserviceHealthCache.start();\r\n```"},"comment":{"url":"https://api.github.com/repos/rickfast/consul-client/issues/comments/405852824","html_url":"https://github.com/rickfast/consul-client/issues/342#issuecomment-405852824","issue_url":"https://api.github.com/repos/rickfast/consul-client/issues/342","id":405852824,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNTg1MjgyNA==","user":{"login":"yfouquet","id":22475230,"node_id":"MDQ6VXNlcjIyNDc1MjMw","avatar_url":"https://avatars2.githubusercontent.com/u/22475230?v=4","gravatar_id":"","url":"https://api.github.com/users/yfouquet","html_url":"https://github.com/yfouquet","followers_url":"https://api.github.com/users/yfouquet/followers","following_url":"https://api.github.com/users/yfouquet/following{/other_user}","gists_url":"https://api.github.com/users/yfouquet/gists{/gist_id}","starred_url":"https://api.github.com/users/yfouquet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yfouquet/subscriptions","organizations_url":"https://api.github.com/users/yfouquet/orgs","repos_url":"https://api.github.com/users/yfouquet/repos","events_url":"https://api.github.com/users/yfouquet/events{/privacy}","received_events_url":"https://api.github.com/users/yfouquet/received_events","type":"User","site_admin":false},"created_at":"2018-07-18T08:29:30Z","updated_at":"2018-07-18T08:29:30Z","author_association":"COLLABORATOR","body":"This check is the consul agent check. It is present for every service.\r\nYou should not worry about it as a service is passing only if all checks are passing.\r\n\r\nThanks for sharing the checks.\r\nOne more question: when you said that the listener was notified at startup, are your services sent to the listener? or is it empty notification?"}}
{"actor":{"display_login":"yfouquet"}}