{"action":"created","comment":{"url":"https://api.github.com/repos/segmentio/metalsmith/pulls/comments/28295324","id":28295324,"diff_hunk":"@@ -197,7 +212,15 @@ Metalsmith.prototype.read = unyield(function*(dir){\n   dir = dir || this.source();\n   var read = this.readFile.bind(this);\n   var paths = yield readdir(dir);\n-  var files = yield paths.map(read);\n+\n+  var files = [];\n+  var complete = 0;\n+  var concurrent = this.concurrent();\n+  while (complete < paths.length) {\n+    files.push.apply(\n+        files, yield paths.slice(complete, complete + concurrent).map(read));","path":"lib/index.js","position":40,"original_position":40,"commit_id":"3f550ad8d3f04810e0bdc19a67664bc6b69c8d03","original_commit_id":"3f550ad8d3f04810e0bdc19a67664bc6b69c8d03","user":{"login":"ianstormtaylor","id":311752,"avatar_url":"https://avatars.githubusercontent.com/u/311752?v=3","gravatar_id":"","url":"https://api.github.com/users/ianstormtaylor","html_url":"https://github.com/ianstormtaylor","followers_url":"https://api.github.com/users/ianstormtaylor/followers","following_url":"https://api.github.com/users/ianstormtaylor/following{/other_user}","gists_url":"https://api.github.com/users/ianstormtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/ianstormtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ianstormtaylor/subscriptions","organizations_url":"https://api.github.com/users/ianstormtaylor/orgs","repos_url":"https://api.github.com/users/ianstormtaylor/repos","events_url":"https://api.github.com/users/ianstormtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/ianstormtaylor/received_events","type":"User","site_admin":false},"body":"Can we break this piece apart to be slightly easier to follow? Less one-liner-ish.","created_at":"2015-04-14T01:42:09Z","updated_at":"2015-04-14T01:42:09Z","html_url":"https://github.com/segmentio/metalsmith/pull/130#discussion_r28295324","pull_request_url":"https://api.github.com/repos/segmentio/metalsmith/pulls/130","_links":{"self":{"href":"https://api.github.com/repos/segmentio/metalsmith/pulls/comments/28295324"},"html":{"href":"https://github.com/segmentio/metalsmith/pull/130#discussion_r28295324"},"pull_request":{"href":"https://api.github.com/repos/segmentio/metalsmith/pulls/130"}}},"pull_request":{"url":"https://api.github.com/repos/segmentio/metalsmith/pulls/130","id":32949902,"html_url":"https://github.com/segmentio/metalsmith/pull/130","diff_url":"https://github.com/segmentio/metalsmith/pull/130.diff","patch_url":"https://github.com/segmentio/metalsmith/pull/130.patch","issue_url":"https://api.github.com/repos/segmentio/metalsmith/issues/130","number":130,"state":"open","locked":false,"title":"Add support for limiting concurrency","user":{"login":"tschaub","id":41094,"avatar_url":"https://avatars.githubusercontent.com/u/41094?v=3","gravatar_id":"","url":"https://api.github.com/users/tschaub","html_url":"https://github.com/tschaub","followers_url":"https://api.github.com/users/tschaub/followers","following_url":"https://api.github.com/users/tschaub/following{/other_user}","gists_url":"https://api.github.com/users/tschaub/gists{/gist_id}","starred_url":"https://api.github.com/users/tschaub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschaub/subscriptions","organizations_url":"https://api.github.com/users/tschaub/orgs","repos_url":"https://api.github.com/users/tschaub/repos","events_url":"https://api.github.com/users/tschaub/events{/privacy}","received_events_url":"https://api.github.com/users/tschaub/received_events","type":"User","site_admin":false},"body":"This adds a `concurrent` method to get/set the maximum number of files that should be opened at once for reading or writing.  By default, concurrent is set to `200`.  This makes Metalsmith work when the number of files in the source directory exceeds `ulimit -n` (where previously it would throw `EMFILE`, see #65).\r\n","created_at":"2015-04-09T12:14:54Z","updated_at":"2015-04-14T01:42:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ca1a29178e4fc8e05ae8ec4be0830039a56d7bb1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/segmentio/metalsmith/pulls/130/commits","review_comments_url":"https://api.github.com/repos/segmentio/metalsmith/pulls/130/comments","review_comment_url":"https://api.github.com/repos/segmentio/metalsmith/pulls/comments{/number}","comments_url":"https://api.github.com/repos/segmentio/metalsmith/issues/130/comments","statuses_url":"https://api.github.com/repos/segmentio/metalsmith/statuses/3f550ad8d3f04810e0bdc19a67664bc6b69c8d03","head":{"label":"tschaub:concurrent","ref":"concurrent","sha":"3f550ad8d3f04810e0bdc19a67664bc6b69c8d03","user":{"login":"tschaub","id":41094,"avatar_url":"https://avatars.githubusercontent.com/u/41094?v=3","gravatar_id":"","url":"https://api.github.com/users/tschaub","html_url":"https://github.com/tschaub","followers_url":"https://api.github.com/users/tschaub/followers","following_url":"https://api.github.com/users/tschaub/following{/other_user}","gists_url":"https://api.github.com/users/tschaub/gists{/gist_id}","starred_url":"https://api.github.com/users/tschaub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschaub/subscriptions","organizations_url":"https://api.github.com/users/tschaub/orgs","repos_url":"https://api.github.com/users/tschaub/repos","events_url":"https://api.github.com/users/tschaub/events{/privacy}","received_events_url":"https://api.github.com/users/tschaub/received_events","type":"User","site_admin":false},"repo":{"id":33664977,"name":"metalsmith","full_name":"tschaub/metalsmith","owner":{"login":"tschaub","id":41094,"avatar_url":"https://avatars.githubusercontent.com/u/41094?v=3","gravatar_id":"","url":"https://api.github.com/users/tschaub","html_url":"https://github.com/tschaub","followers_url":"https://api.github.com/users/tschaub/followers","following_url":"https://api.github.com/users/tschaub/following{/other_user}","gists_url":"https://api.github.com/users/tschaub/gists{/gist_id}","starred_url":"https://api.github.com/users/tschaub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschaub/subscriptions","organizations_url":"https://api.github.com/users/tschaub/orgs","repos_url":"https://api.github.com/users/tschaub/repos","events_url":"https://api.github.com/users/tschaub/events{/privacy}","received_events_url":"https://api.github.com/users/tschaub/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tschaub/metalsmith","description":"An extremely simple, pluggable static site generator.","fork":true,"url":"https://api.github.com/repos/tschaub/metalsmith","forks_url":"https://api.github.com/repos/tschaub/metalsmith/forks","keys_url":"https://api.github.com/repos/tschaub/metalsmith/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tschaub/metalsmith/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tschaub/metalsmith/teams","hooks_url":"https://api.github.com/repos/tschaub/metalsmith/hooks","issue_events_url":"https://api.github.com/repos/tschaub/metalsmith/issues/events{/number}","events_url":"https://api.github.com/repos/tschaub/metalsmith/events","assignees_url":"https://api.github.com/repos/tschaub/metalsmith/assignees{/user}","branches_url":"https://api.github.com/repos/tschaub/metalsmith/branches{/branch}","tags_url":"https://api.github.com/repos/tschaub/metalsmith/tags","blobs_url":"https://api.github.com/repos/tschaub/metalsmith/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tschaub/metalsmith/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tschaub/metalsmith/git/refs{/sha}","trees_url":"https://api.github.com/repos/tschaub/metalsmith/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tschaub/metalsmith/statuses/{sha}","languages_url":"https://api.github.com/repos/tschaub/metalsmith/languages","stargazers_url":"https://api.github.com/repos/tschaub/metalsmith/stargazers","contributors_url":"https://api.github.com/repos/tschaub/metalsmith/contributors","subscribers_url":"https://api.github.com/repos/tschaub/metalsmith/subscribers","subscription_url":"https://api.github.com/repos/tschaub/metalsmith/subscription","commits_url":"https://api.github.com/repos/tschaub/metalsmith/commits{/sha}","git_commits_url":"https://api.github.com/repos/tschaub/metalsmith/git/commits{/sha}","comments_url":"https://api.github.com/repos/tschaub/metalsmith/comments{/number}","issue_comment_url":"https://api.github.com/repos/tschaub/metalsmith/issues/comments{/number}","contents_url":"https://api.github.com/repos/tschaub/metalsmith/contents/{+path}","compare_url":"https://api.github.com/repos/tschaub/metalsmith/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tschaub/metalsmith/merges","archive_url":"https://api.github.com/repos/tschaub/metalsmith/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tschaub/metalsmith/downloads","issues_url":"https://api.github.com/repos/tschaub/metalsmith/issues{/number}","pulls_url":"https://api.github.com/repos/tschaub/metalsmith/pulls{/number}","milestones_url":"https://api.github.com/repos/tschaub/metalsmith/milestones{/number}","notifications_url":"https://api.github.com/repos/tschaub/metalsmith/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tschaub/metalsmith/labels{/name}","releases_url":"https://api.github.com/repos/tschaub/metalsmith/releases{/id}","created_at":"2015-04-09T11:21:38Z","updated_at":"2015-04-09T11:21:39Z","pushed_at":"2015-04-09T12:25:35Z","git_url":"git://github.com/tschaub/metalsmith.git","ssh_url":"git@github.com:tschaub/metalsmith.git","clone_url":"https://github.com/tschaub/metalsmith.git","svn_url":"https://github.com/tschaub/metalsmith","homepage":"metalsmith.io","size":2347,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"segmentio:master","ref":"master","sha":"36fa436bcfdad7ae77e762dc7bf40c75a2dbd7ce","user":{"login":"segmentio","id":819518,"avatar_url":"https://avatars.githubusercontent.com/u/819518?v=3","gravatar_id":"","url":"https://api.github.com/users/segmentio","html_url":"https://github.com/segmentio","followers_url":"https://api.github.com/users/segmentio/followers","following_url":"https://api.github.com/users/segmentio/following{/other_user}","gists_url":"https://api.github.com/users/segmentio/gists{/gist_id}","starred_url":"https://api.github.com/users/segmentio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/segmentio/subscriptions","organizations_url":"https://api.github.com/users/segmentio/orgs","repos_url":"https://api.github.com/users/segmentio/repos","events_url":"https://api.github.com/users/segmentio/events{/privacy}","received_events_url":"https://api.github.com/users/segmentio/received_events","type":"Organization","site_admin":false},"repo":{"id":16501535,"name":"metalsmith","full_name":"segmentio/metalsmith","owner":{"login":"segmentio","id":819518,"avatar_url":"https://avatars.githubusercontent.com/u/819518?v=3","gravatar_id":"","url":"https://api.github.com/users/segmentio","html_url":"https://github.com/segmentio","followers_url":"https://api.github.com/users/segmentio/followers","following_url":"https://api.github.com/users/segmentio/following{/other_user}","gists_url":"https://api.github.com/users/segmentio/gists{/gist_id}","starred_url":"https://api.github.com/users/segmentio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/segmentio/subscriptions","organizations_url":"https://api.github.com/users/segmentio/orgs","repos_url":"https://api.github.com/users/segmentio/repos","events_url":"https://api.github.com/users/segmentio/events{/privacy}","received_events_url":"https://api.github.com/users/segmentio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/segmentio/metalsmith","description":"An extremely simple, pluggable static site generator.","fork":false,"url":"https://api.github.com/repos/segmentio/metalsmith","forks_url":"https://api.github.com/repos/segmentio/metalsmith/forks","keys_url":"https://api.github.com/repos/segmentio/metalsmith/keys{/key_id}","collaborators_url":"https://api.github.com/repos/segmentio/metalsmith/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/segmentio/metalsmith/teams","hooks_url":"https://api.github.com/repos/segmentio/metalsmith/hooks","issue_events_url":"https://api.github.com/repos/segmentio/metalsmith/issues/events{/number}","events_url":"https://api.github.com/repos/segmentio/metalsmith/events","assignees_url":"https://api.github.com/repos/segmentio/metalsmith/assignees{/user}","branches_url":"https://api.github.com/repos/segmentio/metalsmith/branches{/branch}","tags_url":"https://api.github.com/repos/segmentio/metalsmith/tags","blobs_url":"https://api.github.com/repos/segmentio/metalsmith/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/segmentio/metalsmith/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/segmentio/metalsmith/git/refs{/sha}","trees_url":"https://api.github.com/repos/segmentio/metalsmith/git/trees{/sha}","statuses_url":"https://api.github.com/repos/segmentio/metalsmith/statuses/{sha}","languages_url":"https://api.github.com/repos/segmentio/metalsmith/languages","stargazers_url":"https://api.github.com/repos/segmentio/metalsmith/stargazers","contributors_url":"https://api.github.com/repos/segmentio/metalsmith/contributors","subscribers_url":"https://api.github.com/repos/segmentio/metalsmith/subscribers","subscription_url":"https://api.github.com/repos/segmentio/metalsmith/subscription","commits_url":"https://api.github.com/repos/segmentio/metalsmith/commits{/sha}","git_commits_url":"https://api.github.com/repos/segmentio/metalsmith/git/commits{/sha}","comments_url":"https://api.github.com/repos/segmentio/metalsmith/comments{/number}","issue_comment_url":"https://api.github.com/repos/segmentio/metalsmith/issues/comments{/number}","contents_url":"https://api.github.com/repos/segmentio/metalsmith/contents/{+path}","compare_url":"https://api.github.com/repos/segmentio/metalsmith/compare/{base}...{head}","merges_url":"https://api.github.com/repos/segmentio/metalsmith/merges","archive_url":"https://api.github.com/repos/segmentio/metalsmith/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/segmentio/metalsmith/downloads","issues_url":"https://api.github.com/repos/segmentio/metalsmith/issues{/number}","pulls_url":"https://api.github.com/repos/segmentio/metalsmith/pulls{/number}","milestones_url":"https://api.github.com/repos/segmentio/metalsmith/milestones{/number}","notifications_url":"https://api.github.com/repos/segmentio/metalsmith/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/segmentio/metalsmith/labels{/name}","releases_url":"https://api.github.com/repos/segmentio/metalsmith/releases{/id}","created_at":"2014-02-04T03:46:22Z","updated_at":"2015-04-14T00:21:29Z","pushed_at":"2015-04-09T12:25:35Z","git_url":"git://github.com/segmentio/metalsmith.git","ssh_url":"git@github.com:segmentio/metalsmith.git","clone_url":"https://github.com/segmentio/metalsmith.git","svn_url":"https://github.com/segmentio/metalsmith","homepage":"metalsmith.io","size":3105,"stargazers_count":3223,"watchers_count":3223,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":246,"mirror_url":null,"open_issues_count":8,"forks":246,"open_issues":8,"watchers":3223,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/segmentio/metalsmith/pulls/130"},"html":{"href":"https://github.com/segmentio/metalsmith/pull/130"},"issue":{"href":"https://api.github.com/repos/segmentio/metalsmith/issues/130"},"comments":{"href":"https://api.github.com/repos/segmentio/metalsmith/issues/130/comments"},"review_comments":{"href":"https://api.github.com/repos/segmentio/metalsmith/pulls/130/comments"},"review_comment":{"href":"https://api.github.com/repos/segmentio/metalsmith/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/segmentio/metalsmith/pulls/130/commits"},"statuses":{"href":"https://api.github.com/repos/segmentio/metalsmith/statuses/3f550ad8d3f04810e0bdc19a67664bc6b69c8d03"}}}}