{"action":"created","comment":{"url":"https://api.github.com/repos/docker/swarm/pulls/comments/34213170","id":34213170,"diff_hunk":"@@ -158,10 +163,39 @@ func (c *Cluster) hasEngineByAddr(addr string) bool {\n \treturn c.getEngineByAddr(addr) != nil\n }\n \n-func (c *Cluster) addEngine(addr string) bool {\n+func (c *Cluster) addEngine(addr string) {\n+\tres, engine := c.registEngine(addr)\n+\tif !res && engine == nil {\n+\t\t//\t\tticker := time.Tick(reAddEnginePeriod)","path":"cluster/swarm/cluster.go","position":20,"original_position":20,"commit_id":"815e897c782e8978a00f51e9578de902ffa49cec","original_commit_id":"815e897c782e8978a00f51e9578de902ffa49cec","user":{"login":"lokikiller","id":8575608,"avatar_url":"https://avatars.githubusercontent.com/u/8575608?v=3","gravatar_id":"","url":"https://api.github.com/users/lokikiller","html_url":"https://github.com/lokikiller","followers_url":"https://api.github.com/users/lokikiller/followers","following_url":"https://api.github.com/users/lokikiller/following{/other_user}","gists_url":"https://api.github.com/users/lokikiller/gists{/gist_id}","starred_url":"https://api.github.com/users/lokikiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lokikiller/subscriptions","organizations_url":"https://api.github.com/users/lokikiller/orgs","repos_url":"https://api.github.com/users/lokikiller/repos","events_url":"https://api.github.com/users/lokikiller/events{/privacy}","received_events_url":"https://api.github.com/users/lokikiller/received_events","type":"User","site_admin":false},"body":"@vieux I think the comments way maybe better, but I imitate the code in \"discovery/file/file.go\" from 83 line to 100 line, to maintain the coding style.","created_at":"2015-07-09T00:20:40Z","updated_at":"2015-07-09T00:20:40Z","html_url":"https://github.com/docker/swarm/pull/1044#discussion_r34213170","pull_request_url":"https://api.github.com/repos/docker/swarm/pulls/1044","_links":{"self":{"href":"https://api.github.com/repos/docker/swarm/pulls/comments/34213170"},"html":{"href":"https://github.com/docker/swarm/pull/1044#discussion_r34213170"},"pull_request":{"href":"https://api.github.com/repos/docker/swarm/pulls/1044"}}},"pull_request":{"url":"https://api.github.com/repos/docker/swarm/pulls/1044","id":39432517,"html_url":"https://github.com/docker/swarm/pull/1044","diff_url":"https://github.com/docker/swarm/pull/1044.diff","patch_url":"https://github.com/docker/swarm/pull/1044.patch","issue_url":"https://api.github.com/repos/docker/swarm/issues/1044","number":1044,"state":"open","locked":false,"title":"Fix the slave registry failed","user":{"login":"lokikiller","id":8575608,"avatar_url":"https://avatars.githubusercontent.com/u/8575608?v=3","gravatar_id":"","url":"https://api.github.com/users/lokikiller","html_url":"https://github.com/lokikiller","followers_url":"https://api.github.com/users/lokikiller/followers","following_url":"https://api.github.com/users/lokikiller/following{/other_user}","gists_url":"https://api.github.com/users/lokikiller/gists{/gist_id}","starred_url":"https://api.github.com/users/lokikiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lokikiller/subscriptions","organizations_url":"https://api.github.com/users/lokikiller/orgs","repos_url":"https://api.github.com/users/lokikiller/repos","events_url":"https://api.github.com/users/lokikiller/events{/privacy}","received_events_url":"https://api.github.com/users/lokikiller/received_events","type":"User","site_admin":false},"body":"When using the file discovery method, if a slave address failed to registry itself when the scanning the configuration file at the first time (maybe the slave's docker service donot start), the slave will not be registry itself again, even if the slave's docker service started, unless remove the slave's address from the configuration file and add it again.\r\n\r\nSo, I changed the \"addEngine\" function, appending a return parameter \"cluster.Engine\", when the parameter is null, delegating the engine registered failed, and I add a function to loop to registry it every 30s, until it registry successfully.\r\n\r\nSigned-off-by: Tingyi Hao haotingyi13@otcaix.iscas.ac.cn\r\nSigned-off-by: Tingyi Hao <haotingyi13@otcaix.iscas.ac.cn>","created_at":"2015-07-08T00:59:48Z","updated_at":"2015-07-09T00:20:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a7fcaec4bbe656a86b5289a2bbb0bc90233c35dd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/docker/swarm/pulls/1044/commits","review_comments_url":"https://api.github.com/repos/docker/swarm/pulls/1044/comments","review_comment_url":"https://api.github.com/repos/docker/swarm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/docker/swarm/issues/1044/comments","statuses_url":"https://api.github.com/repos/docker/swarm/statuses/815e897c782e8978a00f51e9578de902ffa49cec","head":{"label":"lokikiller:master","ref":"master","sha":"815e897c782e8978a00f51e9578de902ffa49cec","user":{"login":"lokikiller","id":8575608,"avatar_url":"https://avatars.githubusercontent.com/u/8575608?v=3","gravatar_id":"","url":"https://api.github.com/users/lokikiller","html_url":"https://github.com/lokikiller","followers_url":"https://api.github.com/users/lokikiller/followers","following_url":"https://api.github.com/users/lokikiller/following{/other_user}","gists_url":"https://api.github.com/users/lokikiller/gists{/gist_id}","starred_url":"https://api.github.com/users/lokikiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lokikiller/subscriptions","organizations_url":"https://api.github.com/users/lokikiller/orgs","repos_url":"https://api.github.com/users/lokikiller/repos","events_url":"https://api.github.com/users/lokikiller/events{/privacy}","received_events_url":"https://api.github.com/users/lokikiller/received_events","type":"User","site_admin":false},"repo":{"id":38723000,"name":"swarm","full_name":"lokikiller/swarm","owner":{"login":"lokikiller","id":8575608,"avatar_url":"https://avatars.githubusercontent.com/u/8575608?v=3","gravatar_id":"","url":"https://api.github.com/users/lokikiller","html_url":"https://github.com/lokikiller","followers_url":"https://api.github.com/users/lokikiller/followers","following_url":"https://api.github.com/users/lokikiller/following{/other_user}","gists_url":"https://api.github.com/users/lokikiller/gists{/gist_id}","starred_url":"https://api.github.com/users/lokikiller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lokikiller/subscriptions","organizations_url":"https://api.github.com/users/lokikiller/orgs","repos_url":"https://api.github.com/users/lokikiller/repos","events_url":"https://api.github.com/users/lokikiller/events{/privacy}","received_events_url":"https://api.github.com/users/lokikiller/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lokikiller/swarm","description":"Swarm: a Docker-native clustering system","fork":true,"url":"https://api.github.com/repos/lokikiller/swarm","forks_url":"https://api.github.com/repos/lokikiller/swarm/forks","keys_url":"https://api.github.com/repos/lokikiller/swarm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lokikiller/swarm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lokikiller/swarm/teams","hooks_url":"https://api.github.com/repos/lokikiller/swarm/hooks","issue_events_url":"https://api.github.com/repos/lokikiller/swarm/issues/events{/number}","events_url":"https://api.github.com/repos/lokikiller/swarm/events","assignees_url":"https://api.github.com/repos/lokikiller/swarm/assignees{/user}","branches_url":"https://api.github.com/repos/lokikiller/swarm/branches{/branch}","tags_url":"https://api.github.com/repos/lokikiller/swarm/tags","blobs_url":"https://api.github.com/repos/lokikiller/swarm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lokikiller/swarm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lokikiller/swarm/git/refs{/sha}","trees_url":"https://api.github.com/repos/lokikiller/swarm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lokikiller/swarm/statuses/{sha}","languages_url":"https://api.github.com/repos/lokikiller/swarm/languages","stargazers_url":"https://api.github.com/repos/lokikiller/swarm/stargazers","contributors_url":"https://api.github.com/repos/lokikiller/swarm/contributors","subscribers_url":"https://api.github.com/repos/lokikiller/swarm/subscribers","subscription_url":"https://api.github.com/repos/lokikiller/swarm/subscription","commits_url":"https://api.github.com/repos/lokikiller/swarm/commits{/sha}","git_commits_url":"https://api.github.com/repos/lokikiller/swarm/git/commits{/sha}","comments_url":"https://api.github.com/repos/lokikiller/swarm/comments{/number}","issue_comment_url":"https://api.github.com/repos/lokikiller/swarm/issues/comments{/number}","contents_url":"https://api.github.com/repos/lokikiller/swarm/contents/{+path}","compare_url":"https://api.github.com/repos/lokikiller/swarm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lokikiller/swarm/merges","archive_url":"https://api.github.com/repos/lokikiller/swarm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lokikiller/swarm/downloads","issues_url":"https://api.github.com/repos/lokikiller/swarm/issues{/number}","pulls_url":"https://api.github.com/repos/lokikiller/swarm/pulls{/number}","milestones_url":"https://api.github.com/repos/lokikiller/swarm/milestones{/number}","notifications_url":"https://api.github.com/repos/lokikiller/swarm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lokikiller/swarm/labels{/name}","releases_url":"https://api.github.com/repos/lokikiller/swarm/releases{/id}","created_at":"2015-07-08T00:48:21Z","updated_at":"2015-07-08T00:48:21Z","pushed_at":"2015-07-08T00:57:48Z","git_url":"git://github.com/lokikiller/swarm.git","ssh_url":"git@github.com:lokikiller/swarm.git","clone_url":"https://github.com/lokikiller/swarm.git","svn_url":"https://github.com/lokikiller/swarm","homepage":"","size":11911,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"docker:master","ref":"master","sha":"7e4a457a9a719aaff3d70a8108bdd8ffb19aaa75","user":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"repo":{"id":19360616,"name":"swarm","full_name":"docker/swarm","owner":{"login":"docker","id":5429470,"avatar_url":"https://avatars.githubusercontent.com/u/5429470?v=3","gravatar_id":"","url":"https://api.github.com/users/docker","html_url":"https://github.com/docker","followers_url":"https://api.github.com/users/docker/followers","following_url":"https://api.github.com/users/docker/following{/other_user}","gists_url":"https://api.github.com/users/docker/gists{/gist_id}","starred_url":"https://api.github.com/users/docker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/docker/subscriptions","organizations_url":"https://api.github.com/users/docker/orgs","repos_url":"https://api.github.com/users/docker/repos","events_url":"https://api.github.com/users/docker/events{/privacy}","received_events_url":"https://api.github.com/users/docker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/docker/swarm","description":"Swarm: a Docker-native clustering system","fork":false,"url":"https://api.github.com/repos/docker/swarm","forks_url":"https://api.github.com/repos/docker/swarm/forks","keys_url":"https://api.github.com/repos/docker/swarm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/docker/swarm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/docker/swarm/teams","hooks_url":"https://api.github.com/repos/docker/swarm/hooks","issue_events_url":"https://api.github.com/repos/docker/swarm/issues/events{/number}","events_url":"https://api.github.com/repos/docker/swarm/events","assignees_url":"https://api.github.com/repos/docker/swarm/assignees{/user}","branches_url":"https://api.github.com/repos/docker/swarm/branches{/branch}","tags_url":"https://api.github.com/repos/docker/swarm/tags","blobs_url":"https://api.github.com/repos/docker/swarm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/docker/swarm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/docker/swarm/git/refs{/sha}","trees_url":"https://api.github.com/repos/docker/swarm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/docker/swarm/statuses/{sha}","languages_url":"https://api.github.com/repos/docker/swarm/languages","stargazers_url":"https://api.github.com/repos/docker/swarm/stargazers","contributors_url":"https://api.github.com/repos/docker/swarm/contributors","subscribers_url":"https://api.github.com/repos/docker/swarm/subscribers","subscription_url":"https://api.github.com/repos/docker/swarm/subscription","commits_url":"https://api.github.com/repos/docker/swarm/commits{/sha}","git_commits_url":"https://api.github.com/repos/docker/swarm/git/commits{/sha}","comments_url":"https://api.github.com/repos/docker/swarm/comments{/number}","issue_comment_url":"https://api.github.com/repos/docker/swarm/issues/comments{/number}","contents_url":"https://api.github.com/repos/docker/swarm/contents/{+path}","compare_url":"https://api.github.com/repos/docker/swarm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/docker/swarm/merges","archive_url":"https://api.github.com/repos/docker/swarm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/docker/swarm/downloads","issues_url":"https://api.github.com/repos/docker/swarm/issues{/number}","pulls_url":"https://api.github.com/repos/docker/swarm/pulls{/number}","milestones_url":"https://api.github.com/repos/docker/swarm/milestones{/number}","notifications_url":"https://api.github.com/repos/docker/swarm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/docker/swarm/labels{/name}","releases_url":"https://api.github.com/repos/docker/swarm/releases{/id}","created_at":"2014-05-01T23:15:17Z","updated_at":"2015-07-09T00:09:41Z","pushed_at":"2015-07-08T15:43:33Z","git_url":"git://github.com/docker/swarm.git","ssh_url":"git@github.com:docker/swarm.git","clone_url":"https://github.com/docker/swarm.git","svn_url":"https://github.com/docker/swarm","homepage":"","size":11911,"stargazers_count":2860,"watchers_count":2860,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":370,"mirror_url":null,"open_issues_count":119,"forks":370,"open_issues":119,"watchers":2860,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/docker/swarm/pulls/1044"},"html":{"href":"https://github.com/docker/swarm/pull/1044"},"issue":{"href":"https://api.github.com/repos/docker/swarm/issues/1044"},"comments":{"href":"https://api.github.com/repos/docker/swarm/issues/1044/comments"},"review_comments":{"href":"https://api.github.com/repos/docker/swarm/pulls/1044/comments"},"review_comment":{"href":"https://api.github.com/repos/docker/swarm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/docker/swarm/pulls/1044/commits"},"statuses":{"href":"https://api.github.com/repos/docker/swarm/statuses/815e897c782e8978a00f51e9578de902ffa49cec"}}}}