{"action":"created","comment":{"url":"https://api.github.com/repos/github/git-lfs/pulls/comments/38732946","id":38732946,"diff_hunk":"@@ -51,16 +55,22 @@ func (b *Batcher) acceptInput() {\n \texit := false\n \n \tfor {\n-\t\tbatch := b.newBatch()\n+\t\tbatch := make([]Transferable, 0, b.batchSize)\n \tLoop:\n \t\tfor len(batch) < b.batchSize {\n-\t\t\tt, ok := <-b.input\n-\t\t\tif !ok {\n-\t\t\t\texit = true // input channel was closed by Exit()\n-\t\t\t\tbreak Loop\n+\t\t\tselect {\n+\t\t\tcase t, ok := <-b.input:\n+\t\t\t\tif ok {\n+\t\t\t\t\tbatch = append(batch, t)\n+\t\t\t\t} else {\n+\t\t\t\t\texit = true // input channel was closed by Exit()\n+\t\t\t\t\tbreak Loop\n+\t\t\t\t}\n+\t\t\tcase <-time.After(time.Millisecond * 300):","path":"lfs/batcher.go","position":30,"original_position":30,"commit_id":"a45802ce621cd704e8cba3b037bca22054a94d4b","original_commit_id":"a45802ce621cd704e8cba3b037bca22054a94d4b","user":{"login":"sinbad","id":142735,"avatar_url":"https://avatars.githubusercontent.com/u/142735?v=3","gravatar_id":"","url":"https://api.github.com/users/sinbad","html_url":"https://github.com/sinbad","followers_url":"https://api.github.com/users/sinbad/followers","following_url":"https://api.github.com/users/sinbad/following{/other_user}","gists_url":"https://api.github.com/users/sinbad/gists{/gist_id}","starred_url":"https://api.github.com/users/sinbad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sinbad/subscriptions","organizations_url":"https://api.github.com/users/sinbad/orgs","repos_url":"https://api.github.com/users/sinbad/repos","events_url":"https://api.github.com/users/sinbad/events{/privacy}","received_events_url":"https://api.github.com/users/sinbad/received_events","type":"User","site_admin":false},"body":"Is it worth introducing a Flush() operation that does this & allows further items to be added but without needing it to be based on a timeout? The timeout is cool in that it's automatic, but it also makes it less deterministic - unrelated changes can alter the behaviour just because of how the times work out. I've seen this problem a lot in debugging (stuff happens differently when you're debugging because different amounts of time pass when you stick on a breakpoint) particularly in real-time systems and it often needs a 'pausable' time source to eliminate. Although debugging is not really a practical problem right now due to the lack of decent Go debugging facilities, differences in server response times could cause difficult to repeat behaviour - some of that is unavoidable but I'd prefer a deterministic sequence unrelated to time, or at least without any parallel time component other than server responses, in our own code if that's possible.","created_at":"2015-09-04T08:56:56Z","updated_at":"2015-09-04T08:56:56Z","html_url":"https://github.com/github/git-lfs/pull/595#discussion_r38732946","pull_request_url":"https://api.github.com/repos/github/git-lfs/pulls/595","_links":{"self":{"href":"https://api.github.com/repos/github/git-lfs/pulls/comments/38732946"},"html":{"href":"https://github.com/github/git-lfs/pull/595#discussion_r38732946"},"pull_request":{"href":"https://api.github.com/repos/github/git-lfs/pulls/595"}}},"pull_request":{"url":"https://api.github.com/repos/github/git-lfs/pulls/595","id":42644574,"html_url":"https://github.com/github/git-lfs/pull/595","diff_url":"https://github.com/github/git-lfs/pull/595.diff","patch_url":"https://github.com/github/git-lfs/pull/595.patch","issue_url":"https://api.github.com/repos/github/git-lfs/issues/595","number":595,"state":"open","locked":false,"title":"Retry various transfer failures","user":{"login":"rubyist","id":143,"avatar_url":"https://avatars.githubusercontent.com/u/143?v=3","gravatar_id":"","url":"https://api.github.com/users/rubyist","html_url":"https://github.com/rubyist","followers_url":"https://api.github.com/users/rubyist/followers","following_url":"https://api.github.com/users/rubyist/following{/other_user}","gists_url":"https://api.github.com/users/rubyist/gists{/gist_id}","starred_url":"https://api.github.com/users/rubyist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rubyist/subscriptions","organizations_url":"https://api.github.com/users/rubyist/orgs","repos_url":"https://api.github.com/users/rubyist/repos","events_url":"https://api.github.com/users/rubyist/events{/privacy}","received_events_url":"https://api.github.com/users/rubyist/received_events","type":"User","site_admin":true},"body":"We want to retry some calls in the event of an http error. We would typically not retry if the http call was successful and returned a status code, with the exception of upload transfers that can expire and return a 403. There are three calls that can be retried in these cases:\r\n\r\n- [x] Retry once when the transfer fails (timeout, http error, 403 with expiry)\r\n- [x] Retry once when a batch api call fails (timeout, http error)\r\n- [x] Retry once when old api call fails (timeout, http error)\r\n\r\nAnd also:\r\n- [ ] Tests!","created_at":"2015-08-17T23:03:50Z","updated_at":"2015-09-04T08:56:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6eeeac667b44b27be03bc6b7d88846423eb6c67c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/github/git-lfs/pulls/595/commits","review_comments_url":"https://api.github.com/repos/github/git-lfs/pulls/595/comments","review_comment_url":"https://api.github.com/repos/github/git-lfs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/github/git-lfs/issues/595/comments","statuses_url":"https://api.github.com/repos/github/git-lfs/statuses/a45802ce621cd704e8cba3b037bca22054a94d4b","head":{"label":"github:retries","ref":"retries","sha":"a45802ce621cd704e8cba3b037bca22054a94d4b","user":{"login":"github","id":9919,"avatar_url":"https://avatars.githubusercontent.com/u/9919?v=3","gravatar_id":"","url":"https://api.github.com/users/github","html_url":"https://github.com/github","followers_url":"https://api.github.com/users/github/followers","following_url":"https://api.github.com/users/github/following{/other_user}","gists_url":"https://api.github.com/users/github/gists{/gist_id}","starred_url":"https://api.github.com/users/github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/github/subscriptions","organizations_url":"https://api.github.com/users/github/orgs","repos_url":"https://api.github.com/users/github/repos","events_url":"https://api.github.com/users/github/events{/privacy}","received_events_url":"https://api.github.com/users/github/received_events","type":"Organization","site_admin":false},"repo":{"id":13021798,"name":"git-lfs","full_name":"github/git-lfs","owner":{"login":"github","id":9919,"avatar_url":"https://avatars.githubusercontent.com/u/9919?v=3","gravatar_id":"","url":"https://api.github.com/users/github","html_url":"https://github.com/github","followers_url":"https://api.github.com/users/github/followers","following_url":"https://api.github.com/users/github/following{/other_user}","gists_url":"https://api.github.com/users/github/gists{/gist_id}","starred_url":"https://api.github.com/users/github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/github/subscriptions","organizations_url":"https://api.github.com/users/github/orgs","repos_url":"https://api.github.com/users/github/repos","events_url":"https://api.github.com/users/github/events{/privacy}","received_events_url":"https://api.github.com/users/github/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/github/git-lfs","description":"Git extension for versioning large files","fork":false,"url":"https://api.github.com/repos/github/git-lfs","forks_url":"https://api.github.com/repos/github/git-lfs/forks","keys_url":"https://api.github.com/repos/github/git-lfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/github/git-lfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/github/git-lfs/teams","hooks_url":"https://api.github.com/repos/github/git-lfs/hooks","issue_events_url":"https://api.github.com/repos/github/git-lfs/issues/events{/number}","events_url":"https://api.github.com/repos/github/git-lfs/events","assignees_url":"https://api.github.com/repos/github/git-lfs/assignees{/user}","branches_url":"https://api.github.com/repos/github/git-lfs/branches{/branch}","tags_url":"https://api.github.com/repos/github/git-lfs/tags","blobs_url":"https://api.github.com/repos/github/git-lfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/github/git-lfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/github/git-lfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/github/git-lfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/github/git-lfs/statuses/{sha}","languages_url":"https://api.github.com/repos/github/git-lfs/languages","stargazers_url":"https://api.github.com/repos/github/git-lfs/stargazers","contributors_url":"https://api.github.com/repos/github/git-lfs/contributors","subscribers_url":"https://api.github.com/repos/github/git-lfs/subscribers","subscription_url":"https://api.github.com/repos/github/git-lfs/subscription","commits_url":"https://api.github.com/repos/github/git-lfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/github/git-lfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/github/git-lfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/github/git-lfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/github/git-lfs/contents/{+path}","compare_url":"https://api.github.com/repos/github/git-lfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/github/git-lfs/merges","archive_url":"https://api.github.com/repos/github/git-lfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/github/git-lfs/downloads","issues_url":"https://api.github.com/repos/github/git-lfs/issues{/number}","pulls_url":"https://api.github.com/repos/github/git-lfs/pulls{/number}","milestones_url":"https://api.github.com/repos/github/git-lfs/milestones{/number}","notifications_url":"https://api.github.com/repos/github/git-lfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/github/git-lfs/labels{/name}","releases_url":"https://api.github.com/repos/github/git-lfs/releases{/id}","created_at":"2013-09-22T22:03:28Z","updated_at":"2015-09-03T20:04:39Z","pushed_at":"2015-09-03T18:16:03Z","git_url":"git://github.com/github/git-lfs.git","ssh_url":"git@github.com:github/git-lfs.git","clone_url":"https://github.com/github/git-lfs.git","svn_url":"https://github.com/github/git-lfs","homepage":"https://git-lfs.github.com","size":12945,"stargazers_count":2298,"watchers_count":2298,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":159,"mirror_url":null,"open_issues_count":112,"forks":159,"open_issues":112,"watchers":2298,"default_branch":"master"}},"base":{"label":"github:master","ref":"master","sha":"3226d2a652799ebf81026c1ed14d71b783239436","user":{"login":"github","id":9919,"avatar_url":"https://avatars.githubusercontent.com/u/9919?v=3","gravatar_id":"","url":"https://api.github.com/users/github","html_url":"https://github.com/github","followers_url":"https://api.github.com/users/github/followers","following_url":"https://api.github.com/users/github/following{/other_user}","gists_url":"https://api.github.com/users/github/gists{/gist_id}","starred_url":"https://api.github.com/users/github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/github/subscriptions","organizations_url":"https://api.github.com/users/github/orgs","repos_url":"https://api.github.com/users/github/repos","events_url":"https://api.github.com/users/github/events{/privacy}","received_events_url":"https://api.github.com/users/github/received_events","type":"Organization","site_admin":false},"repo":{"id":13021798,"name":"git-lfs","full_name":"github/git-lfs","owner":{"login":"github","id":9919,"avatar_url":"https://avatars.githubusercontent.com/u/9919?v=3","gravatar_id":"","url":"https://api.github.com/users/github","html_url":"https://github.com/github","followers_url":"https://api.github.com/users/github/followers","following_url":"https://api.github.com/users/github/following{/other_user}","gists_url":"https://api.github.com/users/github/gists{/gist_id}","starred_url":"https://api.github.com/users/github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/github/subscriptions","organizations_url":"https://api.github.com/users/github/orgs","repos_url":"https://api.github.com/users/github/repos","events_url":"https://api.github.com/users/github/events{/privacy}","received_events_url":"https://api.github.com/users/github/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/github/git-lfs","description":"Git extension for versioning large files","fork":false,"url":"https://api.github.com/repos/github/git-lfs","forks_url":"https://api.github.com/repos/github/git-lfs/forks","keys_url":"https://api.github.com/repos/github/git-lfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/github/git-lfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/github/git-lfs/teams","hooks_url":"https://api.github.com/repos/github/git-lfs/hooks","issue_events_url":"https://api.github.com/repos/github/git-lfs/issues/events{/number}","events_url":"https://api.github.com/repos/github/git-lfs/events","assignees_url":"https://api.github.com/repos/github/git-lfs/assignees{/user}","branches_url":"https://api.github.com/repos/github/git-lfs/branches{/branch}","tags_url":"https://api.github.com/repos/github/git-lfs/tags","blobs_url":"https://api.github.com/repos/github/git-lfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/github/git-lfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/github/git-lfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/github/git-lfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/github/git-lfs/statuses/{sha}","languages_url":"https://api.github.com/repos/github/git-lfs/languages","stargazers_url":"https://api.github.com/repos/github/git-lfs/stargazers","contributors_url":"https://api.github.com/repos/github/git-lfs/contributors","subscribers_url":"https://api.github.com/repos/github/git-lfs/subscribers","subscription_url":"https://api.github.com/repos/github/git-lfs/subscription","commits_url":"https://api.github.com/repos/github/git-lfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/github/git-lfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/github/git-lfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/github/git-lfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/github/git-lfs/contents/{+path}","compare_url":"https://api.github.com/repos/github/git-lfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/github/git-lfs/merges","archive_url":"https://api.github.com/repos/github/git-lfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/github/git-lfs/downloads","issues_url":"https://api.github.com/repos/github/git-lfs/issues{/number}","pulls_url":"https://api.github.com/repos/github/git-lfs/pulls{/number}","milestones_url":"https://api.github.com/repos/github/git-lfs/milestones{/number}","notifications_url":"https://api.github.com/repos/github/git-lfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/github/git-lfs/labels{/name}","releases_url":"https://api.github.com/repos/github/git-lfs/releases{/id}","created_at":"2013-09-22T22:03:28Z","updated_at":"2015-09-03T20:04:39Z","pushed_at":"2015-09-03T18:16:03Z","git_url":"git://github.com/github/git-lfs.git","ssh_url":"git@github.com:github/git-lfs.git","clone_url":"https://github.com/github/git-lfs.git","svn_url":"https://github.com/github/git-lfs","homepage":"https://git-lfs.github.com","size":12945,"stargazers_count":2298,"watchers_count":2298,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":159,"mirror_url":null,"open_issues_count":112,"forks":159,"open_issues":112,"watchers":2298,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/github/git-lfs/pulls/595"},"html":{"href":"https://github.com/github/git-lfs/pull/595"},"issue":{"href":"https://api.github.com/repos/github/git-lfs/issues/595"},"comments":{"href":"https://api.github.com/repos/github/git-lfs/issues/595/comments"},"review_comments":{"href":"https://api.github.com/repos/github/git-lfs/pulls/595/comments"},"review_comment":{"href":"https://api.github.com/repos/github/git-lfs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/github/git-lfs/pulls/595/commits"},"statuses":{"href":"https://api.github.com/repos/github/git-lfs/statuses/a45802ce621cd704e8cba3b037bca22054a94d4b"}}}}