{"action":"created","comment":{"url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/pulls/comments/192235146","pull_request_review_id":124973318,"id":192235146,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MjIzNTE0Ng==","diff_hunk":"@@ -72,6 +76,34 @@ func (bb *BufferedBulkInserter) Insert(doc interface{}) error {\n \treturn err\n }\n \n+// FlushWithRetry continously writes all buffered documents in one bulk insert until there's no error then resets the buffer.\n+func (bb *BufferedBulkInserter) FlushWithRetry() error {\n+\tfailedInsertCount := 0\n+\tif bb.docCount == 0 {\n+\t\treturn nil\n+\t}\n+\tdefer bb.resetBulk()\n+retry:\n+\tif _, err := bb.bulk.Run(); err != nil {\n+\t\tif strings.Contains(err.Error(), \"Request rate is large\") ||","path":"common/db/buffered_bulk.go","position":33,"original_position":33,"commit_id":"522ac76c7767e5f4189ca4d5c68f3809e38f5769","original_commit_id":"522ac76c7767e5f4189ca4d5c68f3809e38f5769","user":{"login":"jasontho-ms","id":19172212,"node_id":"MDQ6VXNlcjE5MTcyMjEy","avatar_url":"https://avatars0.githubusercontent.com/u/19172212?v=4","gravatar_id":"","url":"https://api.github.com/users/jasontho-ms","html_url":"https://github.com/jasontho-ms","followers_url":"https://api.github.com/users/jasontho-ms/followers","following_url":"https://api.github.com/users/jasontho-ms/following{/other_user}","gists_url":"https://api.github.com/users/jasontho-ms/gists{/gist_id}","starred_url":"https://api.github.com/users/jasontho-ms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasontho-ms/subscriptions","organizations_url":"https://api.github.com/users/jasontho-ms/orgs","repos_url":"https://api.github.com/users/jasontho-ms/repos","events_url":"https://api.github.com/users/jasontho-ms/events{/privacy}","received_events_url":"https://api.github.com/users/jasontho-ms/received_events","type":"User","site_admin":false},"body":"Does the exception contain any indication of the block partially succeeding, or the suggested retry wait?","created_at":"2018-05-31T20:57:36Z","updated_at":"2018-05-31T20:57:36Z","html_url":"https://github.com/SimonJinaphant/mongo-tools/pull/1#discussion_r192235146","pull_request_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/pulls/1","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/SimonJinaphant/mongo-tools/pulls/comments/192235146"},"html":{"href":"https://github.com/SimonJinaphant/mongo-tools/pull/1#discussion_r192235146"},"pull_request":{"href":"https://api.github.com/repos/SimonJinaphant/mongo-tools/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/pulls/1","id":191838220,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkxODM4MjIw","html_url":"https://github.com/SimonJinaphant/mongo-tools/pull/1","diff_url":"https://github.com/SimonJinaphant/mongo-tools/pull/1.diff","patch_url":"https://github.com/SimonJinaphant/mongo-tools/pull/1.patch","issue_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/issues/1","number":1,"state":"open","locked":false,"title":"Initial changes for improved CosmosDB performance","user":{"login":"SimonJinaphant","id":2358577,"node_id":"MDQ6VXNlcjIzNTg1Nzc=","avatar_url":"https://avatars0.githubusercontent.com/u/2358577?v=4","gravatar_id":"","url":"https://api.github.com/users/SimonJinaphant","html_url":"https://github.com/SimonJinaphant","followers_url":"https://api.github.com/users/SimonJinaphant/followers","following_url":"https://api.github.com/users/SimonJinaphant/following{/other_user}","gists_url":"https://api.github.com/users/SimonJinaphant/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonJinaphant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonJinaphant/subscriptions","organizations_url":"https://api.github.com/users/SimonJinaphant/orgs","repos_url":"https://api.github.com/users/SimonJinaphant/repos","events_url":"https://api.github.com/users/SimonJinaphant/events{/privacy}","received_events_url":"https://api.github.com/users/SimonJinaphant/received_events","type":"User","site_admin":false},"body":"## Main changes\r\n- Add incremental wait & retry upon obtaining request rate too large error\r\n- Allow clients to specify `Throughput` for their Fixed or Unlimited collections\r\n- Allow clients to specify `Shard Key` for their Unlimited collections\r\n\r\n### Other changes\r\n- Add simple timer to measure the time importing took","created_at":"2018-05-31T18:34:10Z","updated_at":"2018-05-31T20:57:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1b7991c5aaee4d3601d6299dd5fc6c247127cce5","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/pulls/1/commits","review_comments_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/pulls/1/comments","review_comment_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/issues/1/comments","statuses_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/statuses/522ac76c7767e5f4189ca4d5c68f3809e38f5769","head":{"label":"SimonJinaphant:error-handling","ref":"error-handling","sha":"522ac76c7767e5f4189ca4d5c68f3809e38f5769","user":{"login":"SimonJinaphant","id":2358577,"node_id":"MDQ6VXNlcjIzNTg1Nzc=","avatar_url":"https://avatars0.githubusercontent.com/u/2358577?v=4","gravatar_id":"","url":"https://api.github.com/users/SimonJinaphant","html_url":"https://github.com/SimonJinaphant","followers_url":"https://api.github.com/users/SimonJinaphant/followers","following_url":"https://api.github.com/users/SimonJinaphant/following{/other_user}","gists_url":"https://api.github.com/users/SimonJinaphant/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonJinaphant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonJinaphant/subscriptions","organizations_url":"https://api.github.com/users/SimonJinaphant/orgs","repos_url":"https://api.github.com/users/SimonJinaphant/repos","events_url":"https://api.github.com/users/SimonJinaphant/events{/privacy}","received_events_url":"https://api.github.com/users/SimonJinaphant/received_events","type":"User","site_admin":false},"repo":{"id":135620050,"node_id":"MDEwOlJlcG9zaXRvcnkxMzU2MjAwNTA=","name":"mongo-tools","full_name":"SimonJinaphant/mongo-tools","owner":{"login":"SimonJinaphant","id":2358577,"node_id":"MDQ6VXNlcjIzNTg1Nzc=","avatar_url":"https://avatars0.githubusercontent.com/u/2358577?v=4","gravatar_id":"","url":"https://api.github.com/users/SimonJinaphant","html_url":"https://github.com/SimonJinaphant","followers_url":"https://api.github.com/users/SimonJinaphant/followers","following_url":"https://api.github.com/users/SimonJinaphant/following{/other_user}","gists_url":"https://api.github.com/users/SimonJinaphant/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonJinaphant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonJinaphant/subscriptions","organizations_url":"https://api.github.com/users/SimonJinaphant/orgs","repos_url":"https://api.github.com/users/SimonJinaphant/repos","events_url":"https://api.github.com/users/SimonJinaphant/events{/privacy}","received_events_url":"https://api.github.com/users/SimonJinaphant/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/SimonJinaphant/mongo-tools","description":null,"fork":true,"url":"https://api.github.com/repos/SimonJinaphant/mongo-tools","forks_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/forks","keys_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/teams","hooks_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/hooks","issue_events_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/issues/events{/number}","events_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/events","assignees_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/assignees{/user}","branches_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/branches{/branch}","tags_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/tags","blobs_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/statuses/{sha}","languages_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/languages","stargazers_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/stargazers","contributors_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/contributors","subscribers_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/subscribers","subscription_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/subscription","commits_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/contents/{+path}","compare_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/merges","archive_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/downloads","issues_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/issues{/number}","pulls_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/pulls{/number}","milestones_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/milestones{/number}","notifications_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/labels{/name}","releases_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/releases{/id}","deployments_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/deployments","created_at":"2018-05-31T18:17:25Z","updated_at":"2018-05-31T18:17:29Z","pushed_at":"2018-05-31T18:34:11Z","git_url":"git://github.com/SimonJinaphant/mongo-tools.git","ssh_url":"git@github.com:SimonJinaphant/mongo-tools.git","clone_url":"https://github.com/SimonJinaphant/mongo-tools.git","svn_url":"https://github.com/SimonJinaphant/mongo-tools","homepage":null,"size":16221,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"SimonJinaphant:master","ref":"master","sha":"cc40051150464474d3fb8425beea62e4f0652ca9","user":{"login":"SimonJinaphant","id":2358577,"node_id":"MDQ6VXNlcjIzNTg1Nzc=","avatar_url":"https://avatars0.githubusercontent.com/u/2358577?v=4","gravatar_id":"","url":"https://api.github.com/users/SimonJinaphant","html_url":"https://github.com/SimonJinaphant","followers_url":"https://api.github.com/users/SimonJinaphant/followers","following_url":"https://api.github.com/users/SimonJinaphant/following{/other_user}","gists_url":"https://api.github.com/users/SimonJinaphant/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonJinaphant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonJinaphant/subscriptions","organizations_url":"https://api.github.com/users/SimonJinaphant/orgs","repos_url":"https://api.github.com/users/SimonJinaphant/repos","events_url":"https://api.github.com/users/SimonJinaphant/events{/privacy}","received_events_url":"https://api.github.com/users/SimonJinaphant/received_events","type":"User","site_admin":false},"repo":{"id":135620050,"node_id":"MDEwOlJlcG9zaXRvcnkxMzU2MjAwNTA=","name":"mongo-tools","full_name":"SimonJinaphant/mongo-tools","owner":{"login":"SimonJinaphant","id":2358577,"node_id":"MDQ6VXNlcjIzNTg1Nzc=","avatar_url":"https://avatars0.githubusercontent.com/u/2358577?v=4","gravatar_id":"","url":"https://api.github.com/users/SimonJinaphant","html_url":"https://github.com/SimonJinaphant","followers_url":"https://api.github.com/users/SimonJinaphant/followers","following_url":"https://api.github.com/users/SimonJinaphant/following{/other_user}","gists_url":"https://api.github.com/users/SimonJinaphant/gists{/gist_id}","starred_url":"https://api.github.com/users/SimonJinaphant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimonJinaphant/subscriptions","organizations_url":"https://api.github.com/users/SimonJinaphant/orgs","repos_url":"https://api.github.com/users/SimonJinaphant/repos","events_url":"https://api.github.com/users/SimonJinaphant/events{/privacy}","received_events_url":"https://api.github.com/users/SimonJinaphant/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/SimonJinaphant/mongo-tools","description":null,"fork":true,"url":"https://api.github.com/repos/SimonJinaphant/mongo-tools","forks_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/forks","keys_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/teams","hooks_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/hooks","issue_events_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/issues/events{/number}","events_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/events","assignees_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/assignees{/user}","branches_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/branches{/branch}","tags_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/tags","blobs_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/statuses/{sha}","languages_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/languages","stargazers_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/stargazers","contributors_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/contributors","subscribers_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/subscribers","subscription_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/subscription","commits_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/contents/{+path}","compare_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/merges","archive_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/downloads","issues_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/issues{/number}","pulls_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/pulls{/number}","milestones_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/milestones{/number}","notifications_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/labels{/name}","releases_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/releases{/id}","deployments_url":"https://api.github.com/repos/SimonJinaphant/mongo-tools/deployments","created_at":"2018-05-31T18:17:25Z","updated_at":"2018-05-31T18:17:29Z","pushed_at":"2018-05-31T18:34:11Z","git_url":"git://github.com/SimonJinaphant/mongo-tools.git","ssh_url":"git@github.com:SimonJinaphant/mongo-tools.git","clone_url":"https://github.com/SimonJinaphant/mongo-tools.git","svn_url":"https://github.com/SimonJinaphant/mongo-tools","homepage":null,"size":16221,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SimonJinaphant/mongo-tools/pulls/1"},"html":{"href":"https://github.com/SimonJinaphant/mongo-tools/pull/1"},"issue":{"href":"https://api.github.com/repos/SimonJinaphant/mongo-tools/issues/1"},"comments":{"href":"https://api.github.com/repos/SimonJinaphant/mongo-tools/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/SimonJinaphant/mongo-tools/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/SimonJinaphant/mongo-tools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SimonJinaphant/mongo-tools/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/SimonJinaphant/mongo-tools/statuses/522ac76c7767e5f4189ca4d5c68f3809e38f5769"}},"author_association":"OWNER"}}
{"actor":{"display_login":"jasontho-ms"}}