{"action":"created","issue":{"url":"https://api.github.com/repos/Orange-OpenSource/autosleep/issues/192","repository_url":"https://api.github.com/repos/Orange-OpenSource/autosleep","labels_url":"https://api.github.com/repos/Orange-OpenSource/autosleep/issues/192/labels{/name}","comments_url":"https://api.github.com/repos/Orange-OpenSource/autosleep/issues/192/comments","events_url":"https://api.github.com/repos/Orange-OpenSource/autosleep/issues/192/events","html_url":"https://github.com/Orange-OpenSource/autosleep/issues/192","id":155275127,"number":192,"title":"Proxy : get real state during restart","user":{"login":"arnaudruffin","id":2727108,"avatar_url":"https://avatars.githubusercontent.com/u/2727108?v=3","gravatar_id":"","url":"https://api.github.com/users/arnaudruffin","html_url":"https://github.com/arnaudruffin","followers_url":"https://api.github.com/users/arnaudruffin/followers","following_url":"https://api.github.com/users/arnaudruffin/following{/other_user}","gists_url":"https://api.github.com/users/arnaudruffin/gists{/gist_id}","starred_url":"https://api.github.com/users/arnaudruffin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arnaudruffin/subscriptions","organizations_url":"https://api.github.com/users/arnaudruffin/orgs","repos_url":"https://api.github.com/users/arnaudruffin/repos","events_url":"https://api.github.com/users/arnaudruffin/events{/privacy}","received_events_url":"https://api.github.com/users/arnaudruffin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-05-17T14:32:51Z","updated_at":"2016-05-18T09:32:45Z","closed_at":null,"body":"In current version, when restarting app on incoming traffic we try to handle a transitive \"restart in progress\" state during which the service returns a 503 error code.\r\n\r\nHowever, we check app state using \r\n````\r\ncfClient.applicationsV2()\r\n                    .get(GetApplicationRequest.builder()\r\n                            .applicationId(applicationUuid)\r\n                            .build())\r\n                    .get(Config.CF_API_TIMEOUT)\r\n                    .getEntity().getState();\r\n````\r\nThis will return *asked state* and not actual state. (i.e. will return STARTED after a call to `start`, even if the app is still restarting).\r\n\r\n**This results in forwarding traffic to an app that is not ready... and so receiving the request again as a wildcard proxy** Fortunately the signature header that we've already added protect us from an infinite loop.\r\n\r\nWe should have a look on instances states. CF ApplicationInstancesRequest?"},"comment":{"url":"https://api.github.com/repos/Orange-OpenSource/autosleep/issues/comments/219974350","html_url":"https://github.com/Orange-OpenSource/autosleep/issues/192#issuecomment-219974350","issue_url":"https://api.github.com/repos/Orange-OpenSource/autosleep/issues/192","id":219974350,"user":{"login":"arnaudruffin","id":2727108,"avatar_url":"https://avatars.githubusercontent.com/u/2727108?v=3","gravatar_id":"","url":"https://api.github.com/users/arnaudruffin","html_url":"https://github.com/arnaudruffin","followers_url":"https://api.github.com/users/arnaudruffin/followers","following_url":"https://api.github.com/users/arnaudruffin/following{/other_user}","gists_url":"https://api.github.com/users/arnaudruffin/gists{/gist_id}","starred_url":"https://api.github.com/users/arnaudruffin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arnaudruffin/subscriptions","organizations_url":"https://api.github.com/users/arnaudruffin/orgs","repos_url":"https://api.github.com/users/arnaudruffin/repos","events_url":"https://api.github.com/users/arnaudruffin/events{/privacy}","received_events_url":"https://api.github.com/users/arnaudruffin/received_events","type":"User","site_admin":false},"created_at":"2016-05-18T09:32:45Z","updated_at":"2016-05-18T09:32:45Z","body":"> http://apidocs.cloudfoundry.org/236/apps/get_app_summary.html which returns the current state along with the nb of instances\r\n\r\nI'm not sure `get_app_summary` would be useful, as the `state` return is the same as the app state (=`STARTED` as soon as the start command is launched). The same goes for the `running_instances` field. \r\n\r\n> Actually, we'd need to further discuss this as the strategy for HA and scalability for auto-wake-up might instead direct us with autosleep synchronization among autowakeup instances (as to avoid hammering CC API on every incoming autowakeup received request)\r\n\r\nYes indeed. Too bad we can't rely on route services for now...."}}