{"action":"created","comment":{"url":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments/223139946","pull_request_review_id":162205462,"id":223139946,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMzEzOTk0Ng==","diff_hunk":"@@ -457,43 +469,41 @@ defmodule Task.Supervised do\n       # The parent process is telling us to spawn a new task to process\n       # \"value\". We spawn it and notify the parent about its pid.\n       {:spawn, position, value} ->\n-        {type, pid} = spawn.(parent_pid, normalize_mfa_with_arg(mfa, value))\n-        ref = Process.monitor(pid)\n-\n-        # Schedule a timeout message to ourselves, unless the timeout was set to :infinity\n-        timer_ref =\n-          case timeout do\n-            :infinity -> nil\n-            timeout -> Process.send_after(self(), {:timeout, {monitor_ref, ref}}, timeout)\n-          end\n+        case spawn.(parent_pid, normalize_mfa_with_arg(mfa, value)) do\n+          {:ok, type, pid} ->\n+            ref = Process.monitor(pid)\n+\n+            # Schedule a timeout message to ourselves, unless the timeout was set to :infinity\n+            timer_ref =\n+              case timeout do\n+                :infinity -> nil\n+                timeout -> Process.send_after(self(), {:timeout, {monitor_ref, ref}}, timeout)\n+              end\n \n-        send(parent_pid, {:spawned, {monitor_ref, position}, pid})\n+            send(parent_pid, {:spawned, {monitor_ref, position}, pid})\n \n-        task_info = %{\n-          position: position,\n-          type: type,\n-          pid: pid,\n-          timer_ref: timer_ref,\n-          timed_out?: false\n-        }\n+            running_tasks =\n+              Map.put(running_tasks, ref, %{\n+                position: position,\n+                type: type,\n+                pid: pid,\n+                timer_ref: timer_ref,\n+                timed_out?: false\n+              })\n \n-        running_tasks = Map.put(running_tasks, ref, task_info)\n-        stream_monitor_loop(running_tasks, config)\n+            stream_monitor_loop(running_tasks, config)\n+\n+          {:error, :max_children} ->\n+            send(parent_pid, {:max_children, monitor_ref})\n+            stream_waiting_for_stop_loop(running_tasks, config)","path":"lib/elixir/lib/task/supervised.ex","position":90,"original_position":68,"commit_id":"bbef09885a0ea8ba0e12fe82786373afffb68fce","original_commit_id":"4b7a1e9e5fa719e7fafa3e8209161c6e0f8617dc","user":{"login":"whatyouhide","id":3890250,"node_id":"MDQ6VXNlcjM4OTAyNTA=","avatar_url":"https://avatars3.githubusercontent.com/u/3890250?v=4","gravatar_id":"","url":"https://api.github.com/users/whatyouhide","html_url":"https://github.com/whatyouhide","followers_url":"https://api.github.com/users/whatyouhide/followers","following_url":"https://api.github.com/users/whatyouhide/following{/other_user}","gists_url":"https://api.github.com/users/whatyouhide/gists{/gist_id}","starred_url":"https://api.github.com/users/whatyouhide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whatyouhide/subscriptions","organizations_url":"https://api.github.com/users/whatyouhide/orgs","repos_url":"https://api.github.com/users/whatyouhide/repos","events_url":"https://api.github.com/users/whatyouhide/events{/privacy}","received_events_url":"https://api.github.com/users/whatyouhide/received_events","type":"User","site_admin":false},"body":"Okay. I am not a huge fan of this solution because 1. it complicates the loop by adding indirection since now you don't see all possible messages and 2. it implies that `handle_stop_or_exit` exits the monitor process. But it works. I pushed a commit, if you like it we can get that in in the meantime and I can try and think of a cleaner solution.","created_at":"2018-10-05T21:11:51Z","updated_at":"2018-10-05T21:11:51Z","html_url":"https://github.com/elixir-lang/elixir/pull/8239#discussion_r223139946","pull_request_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/8239","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments/223139946"},"html":{"href":"https://github.com/elixir-lang/elixir/pull/8239#discussion_r223139946"},"pull_request":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/8239"}},"in_reply_to_id":222933185},"pull_request":{"url":"https://api.github.com/repos/elixir-lang/elixir/pulls/8239","id":219219219,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5MjE5MjE5","html_url":"https://github.com/elixir-lang/elixir/pull/8239","diff_url":"https://github.com/elixir-lang/elixir/pull/8239.diff","patch_url":"https://github.com/elixir-lang/elixir/pull/8239.patch","issue_url":"https://api.github.com/repos/elixir-lang/elixir/issues/8239","number":8239,"state":"open","locked":false,"title":"Raise when reaching max chidren in Task.Supervisor.async_stream","user":{"login":"whatyouhide","id":3890250,"node_id":"MDQ6VXNlcjM4OTAyNTA=","avatar_url":"https://avatars3.githubusercontent.com/u/3890250?v=4","gravatar_id":"","url":"https://api.github.com/users/whatyouhide","html_url":"https://github.com/whatyouhide","followers_url":"https://api.github.com/users/whatyouhide/followers","following_url":"https://api.github.com/users/whatyouhide/following{/other_user}","gists_url":"https://api.github.com/users/whatyouhide/gists{/gist_id}","starred_url":"https://api.github.com/users/whatyouhide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whatyouhide/subscriptions","organizations_url":"https://api.github.com/users/whatyouhide/orgs","repos_url":"https://api.github.com/users/whatyouhide/repos","events_url":"https://api.github.com/users/whatyouhide/events{/privacy}","received_events_url":"https://api.github.com/users/whatyouhide/received_events","type":"User","site_admin":false},"body":"Closes #7786.","created_at":"2018-09-30T18:27:23Z","updated_at":"2018-10-05T21:11:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"67476906ccf1d026d712f94d32463576ae8d39e3","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/8239/commits","review_comments_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/8239/comments","review_comment_url":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/issues/8239/comments","statuses_url":"https://api.github.com/repos/elixir-lang/elixir/statuses/bbef09885a0ea8ba0e12fe82786373afffb68fce","head":{"label":"elixir-lang:al/raise-max-children-async-stream","ref":"al/raise-max-children-async-stream","sha":"bbef09885a0ea8ba0e12fe82786373afffb68fce","user":{"login":"elixir-lang","id":1481354,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0ODEzNTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1481354?v=4","gravatar_id":"","url":"https://api.github.com/users/elixir-lang","html_url":"https://github.com/elixir-lang","followers_url":"https://api.github.com/users/elixir-lang/followers","following_url":"https://api.github.com/users/elixir-lang/following{/other_user}","gists_url":"https://api.github.com/users/elixir-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/elixir-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elixir-lang/subscriptions","organizations_url":"https://api.github.com/users/elixir-lang/orgs","repos_url":"https://api.github.com/users/elixir-lang/repos","events_url":"https://api.github.com/users/elixir-lang/events{/privacy}","received_events_url":"https://api.github.com/users/elixir-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":1234714,"node_id":"MDEwOlJlcG9zaXRvcnkxMjM0NzE0","name":"elixir","full_name":"elixir-lang/elixir","private":false,"owner":{"login":"elixir-lang","id":1481354,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0ODEzNTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1481354?v=4","gravatar_id":"","url":"https://api.github.com/users/elixir-lang","html_url":"https://github.com/elixir-lang","followers_url":"https://api.github.com/users/elixir-lang/followers","following_url":"https://api.github.com/users/elixir-lang/following{/other_user}","gists_url":"https://api.github.com/users/elixir-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/elixir-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elixir-lang/subscriptions","organizations_url":"https://api.github.com/users/elixir-lang/orgs","repos_url":"https://api.github.com/users/elixir-lang/repos","events_url":"https://api.github.com/users/elixir-lang/events{/privacy}","received_events_url":"https://api.github.com/users/elixir-lang/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/elixir-lang/elixir","description":"Elixir is a dynamic, functional language designed for building scalable and maintainable applications","fork":false,"url":"https://api.github.com/repos/elixir-lang/elixir","forks_url":"https://api.github.com/repos/elixir-lang/elixir/forks","keys_url":"https://api.github.com/repos/elixir-lang/elixir/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elixir-lang/elixir/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elixir-lang/elixir/teams","hooks_url":"https://api.github.com/repos/elixir-lang/elixir/hooks","issue_events_url":"https://api.github.com/repos/elixir-lang/elixir/issues/events{/number}","events_url":"https://api.github.com/repos/elixir-lang/elixir/events","assignees_url":"https://api.github.com/repos/elixir-lang/elixir/assignees{/user}","branches_url":"https://api.github.com/repos/elixir-lang/elixir/branches{/branch}","tags_url":"https://api.github.com/repos/elixir-lang/elixir/tags","blobs_url":"https://api.github.com/repos/elixir-lang/elixir/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elixir-lang/elixir/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elixir-lang/elixir/git/refs{/sha}","trees_url":"https://api.github.com/repos/elixir-lang/elixir/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elixir-lang/elixir/statuses/{sha}","languages_url":"https://api.github.com/repos/elixir-lang/elixir/languages","stargazers_url":"https://api.github.com/repos/elixir-lang/elixir/stargazers","contributors_url":"https://api.github.com/repos/elixir-lang/elixir/contributors","subscribers_url":"https://api.github.com/repos/elixir-lang/elixir/subscribers","subscription_url":"https://api.github.com/repos/elixir-lang/elixir/subscription","commits_url":"https://api.github.com/repos/elixir-lang/elixir/commits{/sha}","git_commits_url":"https://api.github.com/repos/elixir-lang/elixir/git/commits{/sha}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/comments{/number}","issue_comment_url":"https://api.github.com/repos/elixir-lang/elixir/issues/comments{/number}","contents_url":"https://api.github.com/repos/elixir-lang/elixir/contents/{+path}","compare_url":"https://api.github.com/repos/elixir-lang/elixir/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elixir-lang/elixir/merges","archive_url":"https://api.github.com/repos/elixir-lang/elixir/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elixir-lang/elixir/downloads","issues_url":"https://api.github.com/repos/elixir-lang/elixir/issues{/number}","pulls_url":"https://api.github.com/repos/elixir-lang/elixir/pulls{/number}","milestones_url":"https://api.github.com/repos/elixir-lang/elixir/milestones{/number}","notifications_url":"https://api.github.com/repos/elixir-lang/elixir/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elixir-lang/elixir/labels{/name}","releases_url":"https://api.github.com/repos/elixir-lang/elixir/releases{/id}","deployments_url":"https://api.github.com/repos/elixir-lang/elixir/deployments","created_at":"2011-01-09T08:43:57Z","updated_at":"2018-10-05T13:05:52Z","pushed_at":"2018-10-05T21:10:51Z","git_url":"git://github.com/elixir-lang/elixir.git","ssh_url":"git@github.com:elixir-lang/elixir.git","clone_url":"https://github.com/elixir-lang/elixir.git","svn_url":"https://github.com/elixir-lang/elixir","homepage":"http://elixir-lang.org/","size":37957,"stargazers_count":13946,"watchers_count":13946,"language":"Elixir","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2032,"mirror_url":null,"archived":false,"open_issues_count":25,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":2032,"open_issues":25,"watchers":13946,"default_branch":"master"}},"base":{"label":"elixir-lang:master","ref":"master","sha":"57b71953c1c28df92b2edde9c32729871e08dd87","user":{"login":"elixir-lang","id":1481354,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0ODEzNTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1481354?v=4","gravatar_id":"","url":"https://api.github.com/users/elixir-lang","html_url":"https://github.com/elixir-lang","followers_url":"https://api.github.com/users/elixir-lang/followers","following_url":"https://api.github.com/users/elixir-lang/following{/other_user}","gists_url":"https://api.github.com/users/elixir-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/elixir-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elixir-lang/subscriptions","organizations_url":"https://api.github.com/users/elixir-lang/orgs","repos_url":"https://api.github.com/users/elixir-lang/repos","events_url":"https://api.github.com/users/elixir-lang/events{/privacy}","received_events_url":"https://api.github.com/users/elixir-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":1234714,"node_id":"MDEwOlJlcG9zaXRvcnkxMjM0NzE0","name":"elixir","full_name":"elixir-lang/elixir","private":false,"owner":{"login":"elixir-lang","id":1481354,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE0ODEzNTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1481354?v=4","gravatar_id":"","url":"https://api.github.com/users/elixir-lang","html_url":"https://github.com/elixir-lang","followers_url":"https://api.github.com/users/elixir-lang/followers","following_url":"https://api.github.com/users/elixir-lang/following{/other_user}","gists_url":"https://api.github.com/users/elixir-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/elixir-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elixir-lang/subscriptions","organizations_url":"https://api.github.com/users/elixir-lang/orgs","repos_url":"https://api.github.com/users/elixir-lang/repos","events_url":"https://api.github.com/users/elixir-lang/events{/privacy}","received_events_url":"https://api.github.com/users/elixir-lang/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/elixir-lang/elixir","description":"Elixir is a dynamic, functional language designed for building scalable and maintainable applications","fork":false,"url":"https://api.github.com/repos/elixir-lang/elixir","forks_url":"https://api.github.com/repos/elixir-lang/elixir/forks","keys_url":"https://api.github.com/repos/elixir-lang/elixir/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elixir-lang/elixir/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elixir-lang/elixir/teams","hooks_url":"https://api.github.com/repos/elixir-lang/elixir/hooks","issue_events_url":"https://api.github.com/repos/elixir-lang/elixir/issues/events{/number}","events_url":"https://api.github.com/repos/elixir-lang/elixir/events","assignees_url":"https://api.github.com/repos/elixir-lang/elixir/assignees{/user}","branches_url":"https://api.github.com/repos/elixir-lang/elixir/branches{/branch}","tags_url":"https://api.github.com/repos/elixir-lang/elixir/tags","blobs_url":"https://api.github.com/repos/elixir-lang/elixir/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elixir-lang/elixir/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elixir-lang/elixir/git/refs{/sha}","trees_url":"https://api.github.com/repos/elixir-lang/elixir/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elixir-lang/elixir/statuses/{sha}","languages_url":"https://api.github.com/repos/elixir-lang/elixir/languages","stargazers_url":"https://api.github.com/repos/elixir-lang/elixir/stargazers","contributors_url":"https://api.github.com/repos/elixir-lang/elixir/contributors","subscribers_url":"https://api.github.com/repos/elixir-lang/elixir/subscribers","subscription_url":"https://api.github.com/repos/elixir-lang/elixir/subscription","commits_url":"https://api.github.com/repos/elixir-lang/elixir/commits{/sha}","git_commits_url":"https://api.github.com/repos/elixir-lang/elixir/git/commits{/sha}","comments_url":"https://api.github.com/repos/elixir-lang/elixir/comments{/number}","issue_comment_url":"https://api.github.com/repos/elixir-lang/elixir/issues/comments{/number}","contents_url":"https://api.github.com/repos/elixir-lang/elixir/contents/{+path}","compare_url":"https://api.github.com/repos/elixir-lang/elixir/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elixir-lang/elixir/merges","archive_url":"https://api.github.com/repos/elixir-lang/elixir/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elixir-lang/elixir/downloads","issues_url":"https://api.github.com/repos/elixir-lang/elixir/issues{/number}","pulls_url":"https://api.github.com/repos/elixir-lang/elixir/pulls{/number}","milestones_url":"https://api.github.com/repos/elixir-lang/elixir/milestones{/number}","notifications_url":"https://api.github.com/repos/elixir-lang/elixir/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elixir-lang/elixir/labels{/name}","releases_url":"https://api.github.com/repos/elixir-lang/elixir/releases{/id}","deployments_url":"https://api.github.com/repos/elixir-lang/elixir/deployments","created_at":"2011-01-09T08:43:57Z","updated_at":"2018-10-05T13:05:52Z","pushed_at":"2018-10-05T21:10:51Z","git_url":"git://github.com/elixir-lang/elixir.git","ssh_url":"git@github.com:elixir-lang/elixir.git","clone_url":"https://github.com/elixir-lang/elixir.git","svn_url":"https://github.com/elixir-lang/elixir","homepage":"http://elixir-lang.org/","size":37957,"stargazers_count":13946,"watchers_count":13946,"language":"Elixir","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2032,"mirror_url":null,"archived":false,"open_issues_count":25,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":2032,"open_issues":25,"watchers":13946,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/8239"},"html":{"href":"https://github.com/elixir-lang/elixir/pull/8239"},"issue":{"href":"https://api.github.com/repos/elixir-lang/elixir/issues/8239"},"comments":{"href":"https://api.github.com/repos/elixir-lang/elixir/issues/8239/comments"},"review_comments":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/8239/comments"},"review_comment":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elixir-lang/elixir/pulls/8239/commits"},"statuses":{"href":"https://api.github.com/repos/elixir-lang/elixir/statuses/bbef09885a0ea8ba0e12fe82786373afffb68fce"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"whatyouhide"}}