{"action":"created","issue":{"url":"https://api.github.com/repos/typelevel/cats-effect/issues/31","repository_url":"https://api.github.com/repos/typelevel/cats-effect","labels_url":"https://api.github.com/repos/typelevel/cats-effect/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/typelevel/cats-effect/issues/31/comments","events_url":"https://api.github.com/repos/typelevel/cats-effect/issues/31/events","html_url":"https://github.com/typelevel/cats-effect/pull/31","id":224070479,"number":31,"title":"Optimize async execution","user":{"login":"alexandru","id":11753,"avatar_url":"https://avatars1.githubusercontent.com/u/11753?v=3","gravatar_id":"","url":"https://api.github.com/users/alexandru","html_url":"https://github.com/alexandru","followers_url":"https://api.github.com/users/alexandru/followers","following_url":"https://api.github.com/users/alexandru/following{/other_user}","gists_url":"https://api.github.com/users/alexandru/gists{/gist_id}","starred_url":"https://api.github.com/users/alexandru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexandru/subscriptions","organizations_url":"https://api.github.com/users/alexandru/orgs","repos_url":"https://api.github.com/users/alexandru/repos","events_url":"https://api.github.com/users/alexandru/events{/privacy}","received_events_url":"https://api.github.com/users/alexandru/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-04-25T09:08:12Z","updated_at":"2017-04-25T17:29:01Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/typelevel/cats-effect/pulls/31","html_url":"https://github.com/typelevel/cats-effect/pull/31","diff_url":"https://github.com/typelevel/cats-effect/pull/31.diff","patch_url":"https://github.com/typelevel/cats-effect/pull/31.patch"},"body":"Unless I'm missing something, there's no reason to protect *every single async call* with `onceOnly` in a `flatMap` chain, what we need here is to only protect the source (i.e. the user provided code), because it's not us (the library authors) that will make that mistake.\r\n\r\nThis PR takes the `onceOnly` protection from `unsafeRunAsync` and puts it where it belongs, in `IO.async`. This cuts down on the number of `getAndSet` operations in a `flatMap` loop."},"comment":{"url":"https://api.github.com/repos/typelevel/cats-effect/issues/comments/297105437","html_url":"https://github.com/typelevel/cats-effect/pull/31#issuecomment-297105437","issue_url":"https://api.github.com/repos/typelevel/cats-effect/issues/31","id":297105437,"user":{"login":"alexandru","id":11753,"avatar_url":"https://avatars1.githubusercontent.com/u/11753?v=3","gravatar_id":"","url":"https://api.github.com/users/alexandru","html_url":"https://github.com/alexandru","followers_url":"https://api.github.com/users/alexandru/followers","following_url":"https://api.github.com/users/alexandru/following{/other_user}","gists_url":"https://api.github.com/users/alexandru/gists{/gist_id}","starred_url":"https://api.github.com/users/alexandru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexandru/subscriptions","organizations_url":"https://api.github.com/users/alexandru/orgs","repos_url":"https://api.github.com/users/alexandru/repos","events_url":"https://api.github.com/users/alexandru/events{/privacy}","received_events_url":"https://api.github.com/users/alexandru/received_events","type":"User","site_admin":false},"created_at":"2017-04-25T17:29:01Z","updated_at":"2017-04-25T17:29:01Z","body":"@djspiewak I don't understand, why should it hang? I don't think so - I just tested it.\r\n\r\nAlso:\r\n\r\n```scala\r\nval io = IO(10)\r\n(for (a <- io; b <- io) yield a + b).unsafeRunSync\r\n\r\n//=> res: Int = 20\r\n```"}}
{"actor":{"display_login":"alexandru"}}