{"action":"created","comment":{"url":"https://api.github.com/repos/flynn/flynn-releases/pulls/comments/71551253","id":71551253,"diff_hunk":"@@ -64,35 +64,54 @@ func NewRepository() (*Repository, error) {\n \t\treturn nil, err\n \t}\n \n-\tif _, err := client.Update(); err != nil {\n+\tr := &Repository{client: client}\n+\tif err := r.update(); err != nil {\n \t\treturn nil, err\n \t}\n-\n-\tr := &Repository{client: client}\n \tgo r.updateLoop()\n \treturn r, nil\n }\n \n+func (r *Repository) Channels() []*Channel {\n+\treturn r.channels.Load().([]*Channel)\n+}\n+\n+var updateAttempts = attempt.Strategy{\n+\tTotal: time.Minute,\n+\tDelay: 5 * time.Second,\n+}\n+\n+func (r *Repository) updateLoop() {\n+\tinterval := 5 * time.Minute\n+\n+\tfor range time.Tick(interval) {\n+\t\tif err := updateAttempts.Run(r.update); err != nil {\n+\t\t\tshutdown.Fatal(err)","path":"repository.go","position":89,"original_position":49,"commit_id":"e520c40efcb6687ae901a47c452ffe4dcac6f7b2","original_commit_id":"81c892d1de111fd7ded894cb9e5b550bb58202b4","user":{"login":"titanous","id":13026,"avatar_url":"https://avatars.githubusercontent.com/u/13026?v=3","gravatar_id":"","url":"https://api.github.com/users/titanous","html_url":"https://github.com/titanous","followers_url":"https://api.github.com/users/titanous/followers","following_url":"https://api.github.com/users/titanous/following{/other_user}","gists_url":"https://api.github.com/users/titanous/gists{/gist_id}","starred_url":"https://api.github.com/users/titanous/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/titanous/subscriptions","organizations_url":"https://api.github.com/users/titanous/orgs","repos_url":"https://api.github.com/users/titanous/repos","events_url":"https://api.github.com/users/titanous/events{/privacy}","received_events_url":"https://api.github.com/users/titanous/received_events","type":"User","site_admin":false},"body":"I'm not sure exiting is the right thing to do. It should just be a transient failure, serving stale data is fine. We could throw a last updated at timestamp in the JSON.","created_at":"2016-07-20T15:46:03Z","updated_at":"2016-07-20T15:46:03Z","html_url":"https://github.com/flynn/flynn-releases/pull/1#discussion_r71551253","pull_request_url":"https://api.github.com/repos/flynn/flynn-releases/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/flynn/flynn-releases/pulls/comments/71551253"},"html":{"href":"https://github.com/flynn/flynn-releases/pull/1#discussion_r71551253"},"pull_request":{"href":"https://api.github.com/repos/flynn/flynn-releases/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/flynn/flynn-releases/pulls/1","id":77755310,"html_url":"https://github.com/flynn/flynn-releases/pull/1","diff_url":"https://github.com/flynn/flynn-releases/pull/1.diff","patch_url":"https://github.com/flynn/flynn-releases/pull/1.patch","issue_url":"https://api.github.com/repos/flynn/flynn-releases/issues/1","number":1,"state":"open","locked":false,"title":"Add channel UI with JSON API backend","user":{"login":"lmars","id":488515,"avatar_url":"https://avatars.githubusercontent.com/u/488515?v=3","gravatar_id":"","url":"https://api.github.com/users/lmars","html_url":"https://github.com/lmars","followers_url":"https://api.github.com/users/lmars/followers","following_url":"https://api.github.com/users/lmars/following{/other_user}","gists_url":"https://api.github.com/users/lmars/gists{/gist_id}","starred_url":"https://api.github.com/users/lmars/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lmars/subscriptions","organizations_url":"https://api.github.com/users/lmars/orgs","repos_url":"https://api.github.com/users/lmars/repos","events_url":"https://api.github.com/users/lmars/events{/privacy}","received_events_url":"https://api.github.com/users/lmars/received_events","type":"User","site_admin":false},"body":"Summary:\r\n\r\n* Use an in-memory TUF database which is updated every 5 minutes\r\n* Add `/api/channels` which serves the `stable` and `nightly` channels as JSON, including the current version and history with markdown formatted changelogs\r\n* Add web page which gets the channels from the API, renders the current channel versions followed by the history for each channel\r\n\r\nPreview:\r\n\r\n---\r\n\r\n<img width=\"894\" alt=\"screen shot 2016-07-18 at 03 41 12\" src=\"https://cloud.githubusercontent.com/assets/488515/16905160/ba69a1e4-4c99-11e6-9b2f-4d206f95b3bb.png\">\r\n\r\n---\r\n\r\nThe design could do with some TLC, but I think we should do that in a separate PR.\r\n\r\n/cc @titanous @jvatic ","created_at":"2016-07-18T02:54:12Z","updated_at":"2016-07-20T15:46:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ce32a6cd8050af42bba555ec33bcbdbf9f399976","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/flynn/flynn-releases/pulls/1/commits","review_comments_url":"https://api.github.com/repos/flynn/flynn-releases/pulls/1/comments","review_comment_url":"https://api.github.com/repos/flynn/flynn-releases/pulls/comments{/number}","comments_url":"https://api.github.com/repos/flynn/flynn-releases/issues/1/comments","statuses_url":"https://api.github.com/repos/flynn/flynn-releases/statuses/e520c40efcb6687ae901a47c452ffe4dcac6f7b2","head":{"label":"flynn:ui","ref":"ui","sha":"e520c40efcb6687ae901a47c452ffe4dcac6f7b2","user":{"login":"flynn","id":4973613,"avatar_url":"https://avatars.githubusercontent.com/u/4973613?v=3","gravatar_id":"","url":"https://api.github.com/users/flynn","html_url":"https://github.com/flynn","followers_url":"https://api.github.com/users/flynn/followers","following_url":"https://api.github.com/users/flynn/following{/other_user}","gists_url":"https://api.github.com/users/flynn/gists{/gist_id}","starred_url":"https://api.github.com/users/flynn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flynn/subscriptions","organizations_url":"https://api.github.com/users/flynn/orgs","repos_url":"https://api.github.com/users/flynn/repos","events_url":"https://api.github.com/users/flynn/events{/privacy}","received_events_url":"https://api.github.com/users/flynn/received_events","type":"Organization","site_admin":false},"repo":{"id":63557196,"name":"flynn-releases","full_name":"flynn/flynn-releases","owner":{"login":"flynn","id":4973613,"avatar_url":"https://avatars.githubusercontent.com/u/4973613?v=3","gravatar_id":"","url":"https://api.github.com/users/flynn","html_url":"https://github.com/flynn","followers_url":"https://api.github.com/users/flynn/followers","following_url":"https://api.github.com/users/flynn/following{/other_user}","gists_url":"https://api.github.com/users/flynn/gists{/gist_id}","starred_url":"https://api.github.com/users/flynn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flynn/subscriptions","organizations_url":"https://api.github.com/users/flynn/orgs","repos_url":"https://api.github.com/users/flynn/repos","events_url":"https://api.github.com/users/flynn/events{/privacy}","received_events_url":"https://api.github.com/users/flynn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/flynn/flynn-releases","description":"Flynn Release UI","fork":false,"url":"https://api.github.com/repos/flynn/flynn-releases","forks_url":"https://api.github.com/repos/flynn/flynn-releases/forks","keys_url":"https://api.github.com/repos/flynn/flynn-releases/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flynn/flynn-releases/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flynn/flynn-releases/teams","hooks_url":"https://api.github.com/repos/flynn/flynn-releases/hooks","issue_events_url":"https://api.github.com/repos/flynn/flynn-releases/issues/events{/number}","events_url":"https://api.github.com/repos/flynn/flynn-releases/events","assignees_url":"https://api.github.com/repos/flynn/flynn-releases/assignees{/user}","branches_url":"https://api.github.com/repos/flynn/flynn-releases/branches{/branch}","tags_url":"https://api.github.com/repos/flynn/flynn-releases/tags","blobs_url":"https://api.github.com/repos/flynn/flynn-releases/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flynn/flynn-releases/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flynn/flynn-releases/git/refs{/sha}","trees_url":"https://api.github.com/repos/flynn/flynn-releases/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flynn/flynn-releases/statuses/{sha}","languages_url":"https://api.github.com/repos/flynn/flynn-releases/languages","stargazers_url":"https://api.github.com/repos/flynn/flynn-releases/stargazers","contributors_url":"https://api.github.com/repos/flynn/flynn-releases/contributors","subscribers_url":"https://api.github.com/repos/flynn/flynn-releases/subscribers","subscription_url":"https://api.github.com/repos/flynn/flynn-releases/subscription","commits_url":"https://api.github.com/repos/flynn/flynn-releases/commits{/sha}","git_commits_url":"https://api.github.com/repos/flynn/flynn-releases/git/commits{/sha}","comments_url":"https://api.github.com/repos/flynn/flynn-releases/comments{/number}","issue_comment_url":"https://api.github.com/repos/flynn/flynn-releases/issues/comments{/number}","contents_url":"https://api.github.com/repos/flynn/flynn-releases/contents/{+path}","compare_url":"https://api.github.com/repos/flynn/flynn-releases/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flynn/flynn-releases/merges","archive_url":"https://api.github.com/repos/flynn/flynn-releases/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flynn/flynn-releases/downloads","issues_url":"https://api.github.com/repos/flynn/flynn-releases/issues{/number}","pulls_url":"https://api.github.com/repos/flynn/flynn-releases/pulls{/number}","milestones_url":"https://api.github.com/repos/flynn/flynn-releases/milestones{/number}","notifications_url":"https://api.github.com/repos/flynn/flynn-releases/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flynn/flynn-releases/labels{/name}","releases_url":"https://api.github.com/repos/flynn/flynn-releases/releases{/id}","deployments_url":"https://api.github.com/repos/flynn/flynn-releases/deployments","created_at":"2016-07-17T23:35:56Z","updated_at":"2016-07-20T09:48:53Z","pushed_at":"2016-07-19T21:18:40Z","git_url":"git://github.com/flynn/flynn-releases.git","ssh_url":"git@github.com:flynn/flynn-releases.git","clone_url":"https://github.com/flynn/flynn-releases.git","svn_url":"https://github.com/flynn/flynn-releases","homepage":null,"size":1481,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"flynn:master","ref":"master","sha":"b9b71c7421ad52ab9adaa2a69d48768829a1c168","user":{"login":"flynn","id":4973613,"avatar_url":"https://avatars.githubusercontent.com/u/4973613?v=3","gravatar_id":"","url":"https://api.github.com/users/flynn","html_url":"https://github.com/flynn","followers_url":"https://api.github.com/users/flynn/followers","following_url":"https://api.github.com/users/flynn/following{/other_user}","gists_url":"https://api.github.com/users/flynn/gists{/gist_id}","starred_url":"https://api.github.com/users/flynn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flynn/subscriptions","organizations_url":"https://api.github.com/users/flynn/orgs","repos_url":"https://api.github.com/users/flynn/repos","events_url":"https://api.github.com/users/flynn/events{/privacy}","received_events_url":"https://api.github.com/users/flynn/received_events","type":"Organization","site_admin":false},"repo":{"id":63557196,"name":"flynn-releases","full_name":"flynn/flynn-releases","owner":{"login":"flynn","id":4973613,"avatar_url":"https://avatars.githubusercontent.com/u/4973613?v=3","gravatar_id":"","url":"https://api.github.com/users/flynn","html_url":"https://github.com/flynn","followers_url":"https://api.github.com/users/flynn/followers","following_url":"https://api.github.com/users/flynn/following{/other_user}","gists_url":"https://api.github.com/users/flynn/gists{/gist_id}","starred_url":"https://api.github.com/users/flynn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flynn/subscriptions","organizations_url":"https://api.github.com/users/flynn/orgs","repos_url":"https://api.github.com/users/flynn/repos","events_url":"https://api.github.com/users/flynn/events{/privacy}","received_events_url":"https://api.github.com/users/flynn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/flynn/flynn-releases","description":"Flynn Release UI","fork":false,"url":"https://api.github.com/repos/flynn/flynn-releases","forks_url":"https://api.github.com/repos/flynn/flynn-releases/forks","keys_url":"https://api.github.com/repos/flynn/flynn-releases/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flynn/flynn-releases/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flynn/flynn-releases/teams","hooks_url":"https://api.github.com/repos/flynn/flynn-releases/hooks","issue_events_url":"https://api.github.com/repos/flynn/flynn-releases/issues/events{/number}","events_url":"https://api.github.com/repos/flynn/flynn-releases/events","assignees_url":"https://api.github.com/repos/flynn/flynn-releases/assignees{/user}","branches_url":"https://api.github.com/repos/flynn/flynn-releases/branches{/branch}","tags_url":"https://api.github.com/repos/flynn/flynn-releases/tags","blobs_url":"https://api.github.com/repos/flynn/flynn-releases/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flynn/flynn-releases/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flynn/flynn-releases/git/refs{/sha}","trees_url":"https://api.github.com/repos/flynn/flynn-releases/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flynn/flynn-releases/statuses/{sha}","languages_url":"https://api.github.com/repos/flynn/flynn-releases/languages","stargazers_url":"https://api.github.com/repos/flynn/flynn-releases/stargazers","contributors_url":"https://api.github.com/repos/flynn/flynn-releases/contributors","subscribers_url":"https://api.github.com/repos/flynn/flynn-releases/subscribers","subscription_url":"https://api.github.com/repos/flynn/flynn-releases/subscription","commits_url":"https://api.github.com/repos/flynn/flynn-releases/commits{/sha}","git_commits_url":"https://api.github.com/repos/flynn/flynn-releases/git/commits{/sha}","comments_url":"https://api.github.com/repos/flynn/flynn-releases/comments{/number}","issue_comment_url":"https://api.github.com/repos/flynn/flynn-releases/issues/comments{/number}","contents_url":"https://api.github.com/repos/flynn/flynn-releases/contents/{+path}","compare_url":"https://api.github.com/repos/flynn/flynn-releases/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flynn/flynn-releases/merges","archive_url":"https://api.github.com/repos/flynn/flynn-releases/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flynn/flynn-releases/downloads","issues_url":"https://api.github.com/repos/flynn/flynn-releases/issues{/number}","pulls_url":"https://api.github.com/repos/flynn/flynn-releases/pulls{/number}","milestones_url":"https://api.github.com/repos/flynn/flynn-releases/milestones{/number}","notifications_url":"https://api.github.com/repos/flynn/flynn-releases/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flynn/flynn-releases/labels{/name}","releases_url":"https://api.github.com/repos/flynn/flynn-releases/releases{/id}","deployments_url":"https://api.github.com/repos/flynn/flynn-releases/deployments","created_at":"2016-07-17T23:35:56Z","updated_at":"2016-07-20T09:48:53Z","pushed_at":"2016-07-19T21:18:40Z","git_url":"git://github.com/flynn/flynn-releases.git","ssh_url":"git@github.com:flynn/flynn-releases.git","clone_url":"https://github.com/flynn/flynn-releases.git","svn_url":"https://github.com/flynn/flynn-releases","homepage":null,"size":1481,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/flynn/flynn-releases/pulls/1"},"html":{"href":"https://github.com/flynn/flynn-releases/pull/1"},"issue":{"href":"https://api.github.com/repos/flynn/flynn-releases/issues/1"},"comments":{"href":"https://api.github.com/repos/flynn/flynn-releases/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/flynn/flynn-releases/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/flynn/flynn-releases/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/flynn/flynn-releases/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/flynn/flynn-releases/statuses/e520c40efcb6687ae901a47c452ffe4dcac6f7b2"}}}}
{"actor":{"display_login":"titanous"}}