{"action":"closed","issue":{"url":"https://api.github.com/repos/spion/promise-streams/issues/6","labels_url":"https://api.github.com/repos/spion/promise-streams/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/spion/promise-streams/issues/6/comments","events_url":"https://api.github.com/repos/spion/promise-streams/issues/6/events","html_url":"https://github.com/spion/promise-streams/issues/6","id":111074366,"number":6,"title":"ps.map() only calls mapping function at most 16 times","user":{"login":"aoberoi","id":494795,"avatar_url":"https://avatars.githubusercontent.com/u/494795?v=3","gravatar_id":"","url":"https://api.github.com/users/aoberoi","html_url":"https://github.com/aoberoi","followers_url":"https://api.github.com/users/aoberoi/followers","following_url":"https://api.github.com/users/aoberoi/following{/other_user}","gists_url":"https://api.github.com/users/aoberoi/gists{/gist_id}","starred_url":"https://api.github.com/users/aoberoi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aoberoi/subscriptions","organizations_url":"https://api.github.com/users/aoberoi/orgs","repos_url":"https://api.github.com/users/aoberoi/repos","events_url":"https://api.github.com/users/aoberoi/events{/privacy}","received_events_url":"https://api.github.com/users/aoberoi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-12T23:31:21Z","updated_at":"2015-10-13T01:38:40Z","closed_at":"2015-10-13T01:38:40Z","body":"i've observed that `MapPromiseStream`'s only call their `fn` argument at most 16 times. this means that when a readable stream that emits more than 16 `'data'` events is piped to it, `fn` never gets a chance to run. moreover, the promise returned by `ps.wait(mps)` never resolves or rejects when `mps` is one suffering from the previous problem.\r\n\r\ni've reproduced the issue in a branch on my fork that can be seen here: aoberoi@2f651d1144b589. it isn't a proper test but its useful to illustrate the problem. the output is shown below.\r\n\r\nnode version: ```v4.1.1```\r\n\r\noutput:\r\n```\r\nTAP version 13\r\n# ps.wait\r\nok 1 should wait for the last element\r\n# map-wait\r\nok 2 should wait for the last element\r\n# map-wait 2\r\nreading 1\r\nreading 2\r\nreading 3\r\nreading 4\r\nreading 5\r\nreading 6\r\nreading 7\r\nreading 8\r\nreading 9\r\nreading 10\r\nreading 11\r\nreading 12\r\nreading 13\r\nreading 14\r\nreading 15\r\nreading 16\r\nreading 17\r\nreading 18\r\nreading 19\r\nreading 20\r\nreading 21\r\nreading 22\r\nreading 23\r\nreading 24\r\nreading 25\r\nreading 26\r\nreading 27\r\nreading 28\r\nreading 29\r\nreading 30\r\nreading 31\r\nreading 32\r\ndoubling 1\r\ndoubling 2\r\ndoubling 3\r\ndoubling 4\r\ndoubling 5\r\ndoubling 6\r\ndoubling 7\r\ndoubling 8\r\ndoubling 9\r\ndoubling 10\r\ndoubling 11\r\ndoubling 12\r\ndoubling 13\r\ndoubling 14\r\ndoubling 15\r\ndoubling 16\r\nreading 33\r\nreading 34\r\nreading 35\r\nreading 36\r\nreading 37\r\nreading 38\r\nreading 39\r\nreading 40\r\nreading 41\r\nreading 42\r\nreading 43\r\nreading 44\r\nreading 45\r\nreading 46\r\nreading 47\r\nreading 48\r\nnot ok 3 test exited without ending\r\n  ---\r\n    operator: fail\r\n  ...\r\nnot ok 4 test exited without ending\r\n  ---\r\n    operator: fail\r\n  ...\r\nnot ok 5 test exited without ending\r\n  ---\r\n    operator: fail\r\n  ...\r\n\r\n1..5\r\n# tests 5\r\n# pass  2\r\n# fail  3\r\n```\r\n\r\nyou can see that the mapper (outputs `doubling x`) is only called 16 times, and the readable stream doesn't even finish since its only being read 48 times."}}